Skip to content
Prev 386080 / 398513 Next

formula mungeing

Recursively walk the formula performing the replacement:

g <- function(e, ...) {
    if (length(e) > 1) {
        if (identical(e[[2]], as.name(names(list(...))))) {
          e <- eval(e, list(...))
        }
        if (length(e) > 1) for (i in 1:length(e)) e[[i]] <- Recall(e[[i]], ...)
    }
    e
}

g(f, lambdas = 2:3)
## y ~ qss(x, lambda = 2L) + qss(z, 3L) + s
On Fri, Oct 23, 2020 at 9:33 AM Koenker, Roger W <rkoenker at illinois.edu> wrote: