I have an object that contains the name of a variable as a string example :
OBJECT_containing_variables_name <- "the_variable_I_want_to_read"
Is there a function I can use to read the_variable_I_want_to_read
using the OBJECT_containing_variables_name
as a string?
In fact, I am trying to make a for loop, and I construct the name of my variable with
paste0("tablename$",eval(parse(text= "colnames_as_string[i]")))
This actually retuns the name of my variable as a string like "tablename$colname"
But I want to actually read the variable itself. How can I do this ?
I made some tests :
I already tried eval and parse functions like :
eval( paste0("tablename$",eval(parse(text="colnames_as_string[i]"))) )
but it also returns the name of the variable as a string
I also tried :
eval(parse(text=" paste0("tablename$",eval(parse(text="colnames_as_string[i]"))) "))
but it still returns the name of the variable as a string.