当试图在memosie中传递函数时,我得到了一个Error in FUN(X[[i]], ...) : object 'condition' not found错误,但是如果单独运行,它就可以正常工作了。
这是示例函数,实际上在我闪亮的应用程序中,我也得到了相同的错误
library(ggplot2)
meansdf <- data.frame(means = c(13.8, 14.8), condition = 1:2)
testplot <- function(df, x, y) {
arg <- match.call()
scale <- 0.5
p <- ggplot(df, aes(x = eval(arg$x),
y = eval(arg$y) * scale,
fill = eval(arg$x)))
p + geom_bar(position = "dodge", stat = "identity")
}
a = memoise::memoise(testplot)
a(meansdf, condition, means)发布于 2022-03-21 07:02:34
使用,
a(meansdf, meansdf$condition, meansdf$means)

https://stackoverflow.com/questions/71553677
复制相似问题