我有一个包含以下变量名称的df
:
> 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"
我知道可以使用函数df %>% select(starts_with("X_"))
来选择以X__
开头的变量。
我的问题是,是否有一种函数可以选择那些不以X__
开头的变量。输出应该类似于df %>% select(! starts_with("X_"))
。谢谢。