Last active
May 24, 2017 13:21
-
-
Save lissahyacinth/2b6a244f6e5b44ed467fc92016588a3e to your computer and use it in GitHub Desktop.
Selection without the pain of loading packages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select_multi <- function(df, cols){ | |
if("data.table" %in% class(df)){ | |
return(df[,c(1:ncol(df))[colnames(df) %in% cols], with = FALSE]) | |
} | |
df[,c(1:ncol(df))[colnames(df) %in% cols]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment