I have a number of columns that I would like to remove from a data frame. I know that we can delete them individually using something like:
df$x <- NULL <
There's a function called dropNamed() in Bernd Bischl's BBmisc package that does exactly this.
dropNamed()
BBmisc
BBmisc::dropNamed(df, "x")
The advantage is that it avoids repeating the data frame argument and thus is suitable for piping in magrittr (just like the dplyr approaches):
magrittr
dplyr
df %>% BBmisc::dropNamed("x")