【发布时间】:2016-02-23 20:13:41
【问题描述】:
我有嵌套函数并希望将参数传递给最深的函数。最深的函数已经有默认参数,所以我将更新这些参数值。
我的 mwe 使用的是 plot(),但实际上我使用的是 png(),带有默认的高度和宽度参数。
有什么建议吗?
f1 <- function(...){ f2(...)}
f2 <- function(...){ f3(...)}
f3 <- function(...){ plot(xlab="hello1", ...)}
#this works
f1(x=1:10,y=rnorm(10),type='b')
# I want to update the default xlab value, but it fails:
f1(x=1:10,y=rnorm(10),type='b', xlab='hello2')
【问题讨论】:
-
f3 <- function(myxlab = 'hello1', ...) { plot(xlab = myxlab, ...) }呢?