I'd like to know the difference(s) between those two operations; in this example, they seem to work the same, but there must be situations where one will work and the other not. I just can't figure out when this would be the case.
> a <- 298
> eval(parse(text = "a"))
[1] 298
> get("a")
[1] 298
Thanks in advance
in your example the two functions works the same. But the difference shows up when you want to evaluate an expression of a particular form, example :
eval(parse(text = "x <- 1"))
The eval(parse(...)) command will evaluate the expression in input while get will just return the value stocked in it, in this particular example it will not work with get, because it is an expression (not a variable). So eval(parse(...)) is primarily used to evaluate expressions that you construct (by using paste, etc) in your program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With