Displaying 1 result from an estimated 1 matches for "respapply".
Did you mean:
reapply
2008 Jul 30
1
function to transform response of a formula
Hi,
I am trying to write a function which takes a formula as input and
outputs a new formula with a different response while keeping the rest
of the formula the same.
I.e.
respapply : ( y ~ a+b ) -> ( f(y) ~ a + b )
I have tried the following but it doesn't work. The terms become
invalid as shown below.
respapply <- function(fm, f) {
fm[[2]] <- f(eval(fm[[2]]))
fm;
}
> fm <- formula(y ~ a + b)
> y <- runif(5)
> newfm <- respap...