Inverse to starts_with() in dplyr

Viewed 1775

I have df that has variables with the following names:

> names(df)
 [1] "local authority: district / unitary (as of April 2015)" "oslaua"                                                
 [3] "December 2014"                                          "X__1"                                                  
 [5] "March 2015"                                             "X__2"                                                  
 [7] "June 2015"                                              "X__3"

I know I can select those variables that start with X__ by using a function df %>% select(starts_with("X_")).

My question is whether there would be a function that makes it possible to select exactly those variables that do not start with X__. The output should give something similar to df %>% select(! starts_with("X_")). Thanks in advance

1 Answers
Related