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 <
I keep thinking there must be a better idiom, but for subtraction of columns by name, I tend to do the following:
df <- data.frame(a=1:10, b=1:10, c=1:10, d=1:10) # return everything except a and c df <- df[,-match(c("a","c"),names(df))] df