string - Treat a Character as a variable -


suppose have following code

a<-c(1,2,3) b<-'a' 

now treat string in 'b' variable 'a' when input function or operation. imagine "treat.as.variable()" real function this:

treat.as.variable(b)+c(1,2,4) [1] 2 4 7 

is there function this, predefined? or way in general?

use get function

> get(b) + c(1,2,4) [1] 2 4 7 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -