0 votes
1 view
in R Programming by (5.1k points)

If I load the MASS package:

library(MASS)

then load try to run dplyr::select, I get a error:

library(dplyr)

mtcars %.%

select(mpg)

# Error in select(`__prev`, mpg) : unused argument (mpg)

How can I use dplyr::select with the MASS package loaded?

1 Answer

0 votes
by (24.7k points)
edited by

To use the dplyr functions while the package MASS is loaded, you can do the following:

require(MASS)

require(dplyr)

mtcars %>%

  dplyr::select(mpg)

                     mpg

Mazda RX4           21.0

Mazda RX4 Wag       21.0

Datsun 710          22.8

Hornet 4 Drive      21.4

Hornet Sportabout   18.7

Valiant             18.1

Duster 360          14.3

Merc 240D           24.4

Merc 230            22.8

Merc 280            19.2

If you want to explore more in R programming then watch this R programming tutorial for beginner:

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...