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

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -