In dplyr, I want to exclude columns which contain the word "junk" but, there may not be any column that contain the word "junk". In that case, dplyr should return all columns. But it returns none. See unit test case below.
df<-data.frame(name=paste("name",1:5), age=1:5) str(df) 'data.frame': 5 obs. of 2 variables: $ name: Factor w/ 5 levels "name 1","name 2",..: 1 2 3 4 5 $ age : int 1 2 3 4 5 df1<-df%>%select(-contains("junk")) str(df1) 'data.frame': 5 obs. of 0 variables
More at
http://stackoverflow.com/questions/30496930/in-dplyr-select-with-a-drop-does-not-work