R语言 eval,quote

eval() ’s first argument is an expression. So if you only provide one argument, it will evaluate the expression in the current environment.

假设环境中存在变量 x=10

eval(quote(x), list(x=30)) 相当于

首先,

quote(x)

得到x

之后,

list(x=30)
x

于是得到30

如果是eval(x, list(x=30)), 相当于

首先,

x

得到10

之后,

list(x=30)
10

于是得到10

这里面有层层拨开的关系.