Hi,

On Jul 27, 2009, at 3:01 PM, Noah Silverman wrote:

Hi,

Quick question.

I'm working on training an SVM.

I have a dataframe with about 50 columns. I want to train on 46 of them.

Is there a way to say "All except columns 22,23,25 and 31"?

Assume your dataframe is called "my.data":

my.data[,-c(22,23,25,31)]

Returns the data.frame w/o columns 22,23,25 and 31.

-steve

It would be nice to not have to do +c1 +c2 +c3 +c4, etc for all 48 columns.

Yes, it is nice, isn't it? :-)

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
  |  Memorial Sloan-Kettering Cancer Center
  |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to