It's not really the inverse of assign (that's get), but I think you want substitute.
See http://adv-r.had.co.nz/Computing-on-the-language.html for more details. Hadley On Tue, Aug 27, 2013 at 4:13 PM, Robert Lynch <robert.b.ly...@gmail.com> wrote: > I am looking for a way to extract the name of a variable that has been > passed into a function > > for example > foo <-function(x){ > write.csv(x, file = paste(NAME(x), "csv", sep =".")) > } > > is there a function "NAME" that would let the calls > foo(bar) > write the file bar.csv > and foo(stuff) > write the file stuff.csv > > Robert > > [[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. -- Chief Scientist, RStudio http://had.co.nz/ ______________________________________________ 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.