Handling dplyr and MASS select clashes
If you’re using the MASS package to build models or perform statistical analysis, and using dplyr at the same time, you might have come across an annoying clash between the two packages.
Both the MASS and dplyr libraries have select features and chances are, you may have tried to call select() only to be met with an error. This is an easy thing to fix, but can catch you out.
If you’re looking to work with both dplyr and MASS, you can easily get over the select() clash by calling the dplyr function as follows:
dplyr::select(iris, Species, everything())
By specifying you want to use dplyr via dplyr::, you circumvent the issue of MASS and dplyr effectively squabbling over who owns select(). If you are making use of select() a lot and want to cut down on the call, you can also assign dplyr::select to select:
select <- dplyr::select