[R] Creating new dataset based on variable name

JacobSimmering jacob-simmering at uiowa.edu
Thu Aug 25 22:19:37 CEST 2011


I am trying to import several different SAS transport files into R. I know
how to get the files into R as data frames, however, I don't want to do this
one at a time for all ~60 data sets. I also want to convert the name from
file name to something I can understand (e.g., from q181 to
doctor.visits.2008). 

I created a vector with the new names what I was was hoping to do was
something like

for (i in 1:NROW(vector.with.names){
  paste(vector.with.names[i], sep = "") <- read.xport('file_path',
xport_file_name, sep = "")
}

Each part will paste what I want (e.g, doctor.visits.2008) and the correct
file path and name, however, I get the error that R cannot find paste<-. I
also tried using noquote() but that didn't fix it, but it did create a char
vector that had the code I would need to run. 

I have to think there is an easy way to do it but being a relative newbie to
R, I can't seem to figure it out. 


--
View this message in context: http://r.789695.n4.nabble.com/Creating-new-dataset-based-on-variable-name-tp3769285p3769285.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list