Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in R Programming by (7.3k 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
edited

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:

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...