Change default arguments of an R function at runtime

r, reflection

Solution

UPDATE: 2020-12-13

This method is no longer available

Yes, the Defaults package allows you to do this.

Problem

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

Original source

Related problems