[R] Creating new dataset based on variable name

David Winsemius dwinsemius at comcast.net
Thu Aug 25 23:39:36 CEST 2011


On Aug 25, 2011, at 4:19 PM, JacobSimmering wrote:

> 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 = "")
> }

?get
?assign

>
> 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.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list