[R] subset and lme
Todd Ogden
ogden at stat.sc.edu
Wed Jun 16 17:55:38 CEST 2004
Version of R - the problem is both on 1.8 and 1.9.
Version of nlme - 3.1-48
It turns out that the problem is deeper than what I just posted -- in
other calls to lme, I get error messages saying objects not found,
even when the objects in question are created explicitly before the
lme function call or even arguments to the function that's making the
lme calls! I can do print(obj) just before the lme call, but then if
obj is used in the lme call, it's not found.
Todd
to166 at columbia.edu
>
> Todd Ogden wrote:
>
> > I'm puzzled by the following problem, which appears when
> > attempting to run an analysis on part of a dataset:
> >
> > If I try:
> >
> > csubset <- dat$Diagnosis==0
> > cont <- lme(fixed=cform,
> > random = ~1|StudyName,
> > data=dat,subset=csubset,na.action=na.omit)
> >
> > Then I get:
> >
> > Error in eval(expr, envir, enclos) : Object "csubset" not found
> >
> > But if I do instead:
> >
> > cdat <- dat[dat$Diagnosis==0,]
> > cont <- lme(fixed=cform,
> > random = ~1|StudyName,
> > data=cdat,na.action=na.omit)
> >
> > Then everything is fine.
> >
> > I'm puzzled that the object can't be found. Maybe I'm
> > overlooking something obvious?
> >
>
> Todd,
> What version of R/nlme? I just tried the following:
>
> library(nlme)
> data(Orthodont)
> csubset <- Orthodont$Sex == "Male"
> fm1 <- lme(distance ~ age, data = Orthodont,
> random = ~ 1, subset = csubset)
> fm2 <- lme(distance ~ age, data = Orthodont,
> random = ~ 1, subset = Sex == "Male")
> fm3 <- lme(distance ~ age, data = Orthodont[csubset, ],
> random = ~ 1)
>
> > R.version.string
> [1] "R version 1.9.0, 2004-05-06"
> R> library(help = "nlme")
>
> Information on Package 'nlme'
>
> Description:
>
> Package: nlme
> Version: 3.1-48
> Date: 2004/01/14
> <snip>
>
> --sundar
>
>
>
>
--
More information about the R-help
mailing list