[R] subset
Ngayee J Law
Ngayee.Law at celeradiagnostics.com
Fri Sep 13 20:07:21 CEST 2002
I've found out that I have defined z elsewhere. If I remove z, the problem
is gone. Thanks!
- Jackie
Uwe Ligges
<ligges at statistik.uni-do To: Ngayee J Law <Ngayee.Law at celeradiagnostics.com>
rtmund.de> cc: r-help at stat.math.ethz.ch
Subject: Re: [R] subset
09/13/2002 01:56 AM
Ngayee J Law wrote:
>
> Dear list,
>
> I have a simple question. If I need to run linear regression on a subset
of
> the dataset, will
> the following two commands give the same output:
>
> lm(y ~ as.factor(x1) + as.factor(x2), data, subset = z==Z[1])
>
> and
>
> lm(y ~ as.factor(x1) + as.factor(x2), data[data$z==Z[1],] )
>
> I have got different results running the two commands. Am I missing
> something here, or it
> there a bug on the option subset?
Works for me on R-1.5.1, NT4.0.
Do you have z defined anywhere else?
If not and your version is recent: Can you provide an example?
Please, tell us your version of R and your OS as well.
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list