You can use the following command: tmp <- get(foo) save(tmp,file=paste(foo,'.rData',sep=''))
Best, Mike 2014-06-24 15:35 GMT-05:00 David Stevens <david.stev...@usu.edu>: > R community, > > Apologies if this has been answered. The concept I'm looking for is to > save() an object retrieved using get() for an object > that resulted from using assign. Something like > > save(get(foo),file=paste(foo,'rData',sep='')) > > where assign(foo,obj) creates an object named foo with the contents of obj > assigned. For example, if > > x <- data.frame(v1=c(1,2,3,4),v2=c('1','2','3','4')) > foo = 'my.x' > assign(foo,x) > # (... then modify foo as needed) > save(get(foo),file=paste(foo,'.rData',sep='')) > > # though this generates " in save(get(foo), file = paste(foo, ".rData", > sep = "")) : > object âget(foo)â not found", whereas > > get(foo) > > at the command prompt yields the contents of my.x > > There's a concept I'm missing here. Can anyone help? > > Regards > > David Stevens > > -- > David K Stevens, P.E., Ph.D. > Professor and Head, Environmental Engineering > Civil and Environmental Engineering > Utah Water Research Laboratory > 8200 Old Main Hill > Logan, UT 84322-8200 > 435 797 3229 - voice > 435 797 1363 - fax > david.stev...@usu.edu > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]]
______________________________________________ R-help@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.