Remi.b
Remi.b

Reputation: 18219

R: Using object's name to print what is inside the object

My question is a basic one concerning object type manipulation.

hello = 3
name = 'hello'

I'm looking for a function that allows me to find the value 3 by using only the object name.

Something like:

print.the.thing.called(name)
[1] 3

Thanks a lot !

Upvotes: 0

Views: 66

Answers (1)

juba
juba

Reputation: 49033

Use get to get an object by its name :

R> x <- 2
R> get("x")
[1] 2   

Upvotes: 1

Related Questions