Treat a Character as a variable
character, converters, r, string, variables
Solution
Use `get` function
> get(b) + c(1,2,4)
[1] 2 4 7
Problem
Suppose I have the following code ``` a<-c(1,2,3) b<-'a' ``` Now I was to treat the string in 'b' as the variable 'a' when I input it into some function or operation. Like imagine that "treat.as.variable()" was a real function it would do this: ``` treat.as.variable(b)+c(1,2,4) [1] 2 4 7 ``` is there a function like this, predefined? Or a way to do this in general?