我正在try 将一个函数实参(或参数)传递给gggraph--下面是一个要显示/测试的虚拟数据集
test <- data.frame(id=c(1,2,3,4,5),
base=c(230,365,390,201,298),
heig=c(200,310,90,100, 91),
widt=c(21,75,22,46,51))
fun1 <- function(va1,va2){
ggplot(data=test,mapping=aes(va1, va2)) + geom_point()
}
fun1(base,heig)
我收到一个错误:
Error in `geom_point()`: ! Problem while computing aesthetics. ℹ Error occurred in the 1st layer. Caused by error in `FUN()`: ! object 'base' not found Run `rlang::last_trace()` to see where the error occurred.
为了调用函数param,我try 了ggploy中的{{}}
、[[]]
和其他组合,但都无济于事.