Use the subset function and the select argument of that function to specify the columns.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Li, > Aiguo (NIH/NCI) [C] > Sent: Tuesday, March 06, 2007 2:02 PM > To: r-help@stat.math.ethz.ch > Subject: [R] Subseting data frame based on column names > > Hello all, > > > > I have a data frame containing 170 columns and would like to > generate a new data frame containing all rows but only 67 > columns selected according to column names. How can I do this? > > > > Thanks in advance, > > > > AG Lee > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > ______________________________________________ R-help@stat.math.ethz.ch 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.