[R] Remove columns by name data[-c("subj","drug")]

Dieter Menne dieter.menne at menne-biomed.de
Tue Feb 27 10:27:37 CET 2001


Is there an easy way to remove data frame columns
by name instead of by index? The following gives
the idea

remove<-c("subj","drug")
data[-remove]

I found a solution with a few evals and substitutes,
similar to that used in reshapeLong, but there must
be an easier way out.

Dieter


---------------------------------------
Dr. Dieter Menne
Biomed Software
72074 Tübingen
Tel (49) (7071) 52176
FAX (49) (7071) 55 10 46
dieter.menne at menne-biomed.de
www.menne-biomed.de

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list