I manage to select all variables that contains an specific string in its name by:
df[grep("string1|string2",names(df))]
But what I really want to do is to keep those variables and drop the rest. I can do:
df2<-df[grep("string1|string2",names(df))]
But was wondering if I could simply drop those variables I am not interested in instead of creating another data frame. I tried:
null<-X_total[grep("!(mean|std)",names(X_total))
But did not work.