How to remove/drop columns in a data frame

Post date: Jun 29, 2013 6:50:32 PM

You can do something like this

X = X[,!(names(X) %in% c("VAR2"))]; 

Some more good examples can be found here:

http://stackoverflow.com/a/4605268