Re: [R] value of variable in ls()

2015-10-19 Thread peter dalgaard
On 19 Oct 2015, at 16:16 , James Toll wrote: > >> On Oct 18, 2015, at 10:51 AM, Christian Hoffmann >> 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: > > sap

Re: [R] value of variable in ls()

2015-10-19 Thread James Toll
> On Oct 18, 2015, at 10:51 AM, Christian Hoffmann > 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) James __

Re: [R] value of variable in ls()

2015-10-18 Thread jim holtman
Is this what you want:: > a <- 1 > b <- 2 > # get current objects > x <- ls() > # create list of values > my_list <- lapply(x, get) > # now add the names > names(my_list) <- x > my_list # print values $a [1] 1 $b [1] 2 Jim Holtman Data Munger Guru What is the problem that you are trying to so

Re: [R] value of variable in ls()

2015-10-18 Thread ruipbarradas
Hello, I'm not sure I understand, but something like this? a <- 5 get("a") See ?get Hope this helps, Rui Barradas   Citando Christian Hoffmann : > This may seem trivial: > > ls() gives me names of variables as a character vector. How can I print > the values 'behind' those character values: >

[R] value of variable in ls()

2015-10-18 Thread Christian Hoffmann
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