在运行时更改 R 函数的默认参数 [英] Change default arguments of an R function at runtime
本文介绍了在运行时更改 R 函数的默认参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在运行时更改 R 函数中形式参数的默认值?
让我们假设,我们有函数
f <- function(x=1) {...}
我可以以某种方式将 x 的默认值从 1 更改为 2 吗?
提前致谢,
斯文
解决方案
UPDATE: 2020-12-13
<块引用>此方法不再可用
是的,Defaults 包允许您执行此操作.>
Is it possible to change the default values of formal parameters in an R function at runtime?
Let's assume, we have the function
f <- function(x=1) {
...
}
can I somehow change the default value of x from 1 to, say, 2?
Thanks in advance,
Sven
解决方案
UPDATE: 2020-12-13
This method is no longer available
Yes, the Defaults package allows you to do this.
这篇关于在运行时更改 R 函数的默认参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文