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

這里面有層層撥開的關系.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM