dspgs dspgs - 1 year ago 55
R Question

How to call an vector inside a list without explicitly referencing object's name?

I have a list mylist and I know how to call one of its object by its name

[1] 39.67125 33.33558 33.75013 51.71748 47.86691 35.98055

But when I try to get the same result with using x,

x <- "26533"

R tells me the result is NULL.
Can anyone tell me what is the problem?

Answer Source

We can use [[ to pass a variable to extract the list element


If there are multiple elements in 'x', use [

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download