[R] get more than get

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Feb 28 16:18:17 CET 2007


Alberto Monteiro wrote:
> This must be a stupid question, but is there any "extension" of get?
> 
> For example:
> x <- 10
> get("x") # gives me 10
> get("x^2") # gives me an error

  'get' really only gets R objects - you want to evaluate an expression 
- like this:

 > x=2
 > eval(parse(text="x^2"))
[1] 4

Barry



More information about the R-help mailing list