考虑一个简单的函数,它将 ggtitle 添加到 grob
f <- function(PLOT, TITLE) {
PLOT + ggtitle(TITLE)
}
直接调用函数按预期工作。但是,当是一个对象时
,调用该函数do.call(f, ..)
会引发错误TITLE
language
## Sample Data
TIT <- bquote(atop("This is some text", atop(italic("Here is some more text"))))
P <- qplot(x=1:10, y=1:10, geom="point")
## WORKS FINE
f(P, TIT)
## FAILS
do.call(f, list(P, TIT))
## Error in labs(title = label) : could not find function "atop"
这当然只发生在TIT
语言对象
TIT.char <- "This is some text\nHere is some more text"
do.call(f, list(P, TIT.char))
## No Error
当参数是语言对象时如何do.call()
正确使用?