luciano luciano - 3 months ago 47
R Question

dplyr::select function clashes with MASS::select

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?

Answer

As Pascal said, the following works

require(MASS)
require(dplyr)
mtcars %>%
   dplyr::select(mpg)
Comments