[R] paste data

Ido M. Tamir tamir at imp.ac.at
Wed Jun 18 10:49:51 CEST 2008


>I want to do very similar things with all the dataframes and their structure 
>is also the same.
>Is there a way to write a loop? (so that I don't have to write the same 18 
>times)
>I tried things like that:
>for (x in 1:length(plot))
>{
>       plot(paste("auto.",plot[x],sep="")[,1],
>       paste("auto.",plot[x],sep="")[,2],col=...) 
>}

you need to get() the data frames.


for (x in 1:length(plot))
{
	df  <- get(plot[x])
        plot(df[,1],df[,2],col=...)
}


HTH,
ido



More information about the R-help mailing list