I am aware that this is how we get the global variable names in R:
var <- as.list(.GlobalEnv)
var_names <- names(var)
Once you get the names, is there a way to call the variables using var_names?
For instance, if var_names[1] = "a"
, I would want to write function(var_name[1])
and have it refer to a
.