我的问题是关于以下代码:
myfunc <- function(v1) {
deparse(substitute(v1))
}
myfunc(foo)
[1] "foo"
Run Code Online (Sandbox Code Playgroud)
我在 R 中输入?deparse和?substitute并获得以下结果:
deparse = Turn unevaluated expressions into character strings.
Run Code Online (Sandbox Code Playgroud)
和
substitute = returns the parse tree for the (unevaluated) expression expr,
substituting any variables bound in env.
Run Code Online (Sandbox Code Playgroud)
我似乎不太懂这种语言。有人能够简化这些描述的技术方面,以便我能够开始理解这两个函数如何协同工作,让我们能够做一些很酷的事情,比如访问对象的变量名?
r ×1