[R] Subseting data frame based on column names

Greg Snow Greg.Snow at intermountainmail.org
Tue Mar 6 23:12:18 CET 2007


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
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Li, 
> Aiguo (NIH/NCI) [C]
> Sent: Tuesday, March 06, 2007 2:02 PM
> To: r-help at 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 at 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.
>



More information about the R-help mailing list