Drop Columns R Data frame
- by Btibert3
I have a number of columns that I would like to drop from a data frame. I know that we can drop them using something like:
df$x <- NULL
but I was hoping to do this with less commands.
Also, I know that I could use this:
df[ -c(1,3:6, 12) ]
but I am concerned that the relative position of my variables may change.
Given how powerful R is, I figured I would ask to see if there is another way beyond dropping each column 1 by 1.
Thanks in advance.