It’s often convenient to use reflection to get the value of a variable from the name as a string. In R, you can use the get
function to do this.
In R :
1 2 3 4 5 |
|
In Ruby:
1 2 3 4 5 |
|
though Ruby’s eval
is more general, and is equivalent to eval in R allowing you to evaluate arbitrary code in a string.