[R] why does this simple example NOT work?

Berend Hasselman bhh at xs4all.nl
Fri Jul 20 09:09:47 CEST 2012


Martin Ivanov wrote
> 
> Hello,
> 
> I want to create and save objects in a loop, but this is precluded by the
> following obstacle:
> this part of the script fails to work:
> 
> assign(x=paste("a", 1, sep=""), value=1);
> save(paste("a", 1, sep=""), file=paste(paste("a", 1, sep=""), ".RData",
> sep=""))
> 
> Do you know any workaround? I am already out of ideas.
> 

You haven't given the error message R provides.
Carefully read the documentation of save.

save(list=paste("a", 1, sep=""), file=paste(paste("a", 1, sep=""), ".RData",
sep=""))

This "works" for for me.

Berend




--
View this message in context: http://r.789695.n4.nabble.com/why-does-this-simple-example-NOT-work-tp4637158p4637159.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list