R语言 eval(quote(x)) 和 eval(x)

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

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

posted @ 2019-04-11 20:54  2021年的顺遂平安君  阅读(1488)  评论(0编辑  收藏  举报