[R] value of variable in ls()

Christian Hoffmann christian at echoffmann.ch
Sun Oct 18 17:51:13 CEST 2015


This may seem trivial:

ls() gives me names of variables as a character vector. How can I print 
the values 'behind' those character values:

ls()
 > "a"
 > a
[1] 5

How can I do e.g. print("unknown"(ls())) and get the variable values in 
my current environment?

-- 
Christian W. Hoffmann
CH - 8915 Hausen am Albis, Schweiz
Rigiblickstrasse 15 b, Tel.+41-44-7640853
mailto: christian at echoffmann.ch
home: www.echoffmann.ch



More information about the R-help mailing list