Skip to content

selecting columns

2 messages · Clayton Dorrity, Phil Spector

#
Clayton -
    From your explanation, it sounds like you want to create 
a new file removing the "Location" variable, and all the 
variables that have the string "Ambient" or "Name" in their names.
Suppose that your data frame is called mydata, and you wish to 
create a reduced csv file called "mydata.csv"

write.csv(mydata[,grep('Location|Ambient|Name',names(mydata),invert=TRUE)],
           file='mydata.csv')

should do what you want, but without a more concrete example, it's
just a guess.

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu
On Tue, 15 Feb 2011, Clayton Dorrity wrote: