Re: [R] paste data

From: Ido M. Tamir <tamir_at_imp.ac.at>
Date: Wed, 18 Jun 2008 10:49:51 +0200


>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



R-help_at_r-project.org 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. Received on Wed 18 Jun 2008 - 14:38:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Jun 2008 - 15:00:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive