[R] How to include an externally defined NULL value in lm

2008-03-03 Thread Matthieu Stigler
Hello! I would love to be able to include an external variable to a lm call, I mean something: if(TRUE) a-freeny.x[,4] else a-NULL lm(freeny.y~freeny.x[,-4] +a) but it does not work with a-NULL, whereas lm(freeny.y~freeny.x[,-4] +NULL) I don't understand why and did not find an

Re: [R] How to include an externally defined NULL value in lm

2008-03-03 Thread markleeds
From: Matthieu Stigler [EMAIL PROTECTED] Date: 2008/03/03 Mon PM 04:07:09 CST To: r-help@r-project.org Subject: [R] How to include an externally defined NULL value in lm maybe you should a-0 unless there's special behavior of NULL that's unknownst to me ? Hello! I would love to be able to

Re: [R] How to include an externally defined NULL value in lm

2008-03-03 Thread Rolf Turner
Matthieu wants to manipulate the *formula* --- i.e. control what predictors go into the formula --- rather than to add something to one of the predictors (or not, as the case maybe). I.e. what is wanted is that if ``condition'' is TRUE then the formula should be freeny.y ~ freeny.x[,-4]

Re: [R] How to include an externally defined NULL value in lm

2008-03-03 Thread Gabor Grothendieck
It could be done like this: a - if (TRUE) . ~ . + freeny.x[,4] else . ~ . fo - update(freey.y ~ freeny.x[, -4], a) fo freey.y ~ freeny.x[, -4] + freeny.x[, 4] On Mon, Mar 3, 2008 at 6:24 PM, Rolf Turner [EMAIL PROTECTED] wrote: Matthieu wants to manipulate the *formula* --- i.e. control