[R] How to exclude a column by name?

Zeljko Vrba zvrba at ifi.uio.no
Wed May 27 12:37:51 CEST 2009

Given an arbitrary data frame, it is easy to exclude a column given its index:
df[,-2].  How to do the same thing given the column name?  A naive attempt
df[,-"name"] did not work :)

More information about the R-help mailing list