Re: [R] function to transform response of a formula

2008-07-30 Thread Paul Emberson
Hi, I am now trying to use update.formula from within a function but I am not able to get the result I want. Here is an example f <- function(fm, n) { update(fm, n*. ~ .); } If I run > fm <- formula( y ~ a + b ) > f(fm,3) n * y ~ a + b Now when I try to use the formula, n does not exis

Re: [R] function to transform response of a formula

2008-07-30 Thread email
Its ok. I've just read about update.formula in another message. Paul Paul Emberson wrote: 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 ) ->

[R] function to transform response of a formula

2008-07-30 Thread Paul Emberson
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