On 19 Oct 2015, at 16:16 , James Toll <[email protected]> wrote: > >> On Oct 18, 2015, at 10:51 AM, Christian Hoffmann <[email protected]> >> wrote: >> >> How can I do e.g. print("unknown"(ls())) and get the variable values in my >> current environment? > > From your example, it sounds like what you want is simply this: > > sapply(ls(), get) >
Perhaps lapply rather than sapply; I don't think the simplification step of the latter is desirable. Incidentally, both variations are effectively crossing the creek to fetch as.list(GlobalEnv). If your environment contains large objects, you will get what you asked for, but that might well be more than you expected. > > James > > ______________________________________________ > [email protected] mailing list -- To UNSUBSCRIBE and more, see > 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: [email protected] Priv: [email protected] ______________________________________________ [email protected] mailing list -- To UNSUBSCRIBE and more, see 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.

