Roc*_*nce 5 callstack r coercion
我试图了解callR中的对象是什么,并将其强制转换为角色.然而,到目前为止,我的努力是徒劳的.
myFun=function(a=1) { x=sys.call() return(as.character(x)) }
x=myFun(a=2) # here I would like to get the string "myFun(a = 2)"
Run Code Online (Sandbox Code Playgroud)
我一直在寻找打印函数调用的函数(类似的东西print.call).但我找不到它.
这里有人知道如何打印调用对象吗?
我们可以使用match.call()与deparse
myFun <- function(a=1) {
deparse(match.call())
}
myFun(a=2)
#[1] "myFun(a = 2)"
Run Code Online (Sandbox Code Playgroud)
或更换match.call()同sys.call()在功能
| 归档时间: |
|
| 查看次数: |
77 次 |
| 最近记录: |