Progr-RRR / ZHR

ZH R Course "R Programming" -- collaborative pages
1 stars 1 forks source link

Can we discuss evaluating expressions / text? #1

Open mbannert opened 7 years ago

mbannert commented 7 years ago

There's quite a popular thread on SO that discusses eval and it would interesting to get an expert's opinion on this:

> eval(parse(text="5+5"))
[1] 10
> class("5+5")
[1] "character"
> class(parse(text="5+5"))
[1] "expression"

See also here: http://stackoverflow.com/questions/1743698/evaluate-expression-given-as-a-string

fabiangehring commented 7 years ago

+1

Could we even elaborate on how/why eval(expression("5+5")) behaves differently?

mmaechler commented 7 years ago

Sorry but that "trendy" question was asked in 2009.... and I have now answered some more.

@fabiangehring I don't understand your Q .. or then I think what you say is wrong... maybe we can look at it quickly tomorrow early.