Back
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)
library(dplyr)
mtcars %.%
select(mpg)
# Error in select(`__prev`, mpg) : unused argument (mpg)
How can I use dplyr::select with the MASS package loaded?
To use the dplyr functions while the package MASS is loaded, you can do the following:
require(MASS)require(dplyr)mtcars %>% dplyr::select(mpg) mpgMazda RX4 21.0Mazda RX4 Wag 21.0Datsun 710 22.8Hornet 4 Drive 21.4Hornet Sportabout 18.7Valiant 18.1Duster 360 14.3Merc 240D 24.4Merc 230 22.8Merc 280 19.2
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