[R] Problems with subsets in NLME

David Winsemius dwinsemius at comcast.net
Thu Jun 25 17:45:32 CEST 2009


On Jun 25, 2009, at 11:35 AM, Rebecca Sela wrote:

> I am trying to estimate models with subsets using the NLME package.   
> However, I am getting an error in the case below (among others):
>> subset <- c(rep(TRUE, 107), FALSE)
>> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1,  
>> subset=subset)
> Error in xj[i] : invalid subscript type 'closure'
>> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1,  
>> subset=1:107)
>
> The second estimation works.
>
> Does anyone know if there is another work-around?  (I have also e- 
> mailed the package maintainers, but one of the e-mails bounced, so I  
> am trying this list as well.)

Hard to tell. Closure is a type of function. It appears that R might  
be mistaking its own function "subset" for the object that you  
intended to pass. Perhaps if you stopped calling your dogs, "Dog"?

 > library(fortunes)
 > fortune("dog")

> Thank you!
>
> Rebecca
>
> --
> Rebecca Sela
> IOMS/Statistics Group
> Stern School of Business
> New York University
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list