[R] problem with get() inside of lme()

chuck.01 CharlieTheBrown77 at gmail.com
Sat May 12 22:20:40 CEST 2012


please note that I edited the original message to say:

> length(with(new3, perm.score))==length(with(new3, get(TRAIT1))) 
[1] TRUE 





chuck.01 wrote
> 
> Hi, 
>  The following lines of code are inside of a function, where  "TRAIT1" is
> a function variable calling a column-name inside of the data.frame "new3".
> 
> This works just fine: 
> 
> m2 <- lmer(get(TRAIT1) ~ perm.score + (1|site), data=new3)
> 
> but this will not work:
> 
> m3 <- lme(get(TRAIT1) ~ perm.score , random= ~1|site, data=new3)
> 
> I get the following error:
> 
> Error in model.frame.default(formula = ~TRAIT1 + perm.score + site, data =
> list( : 
>   variable lengths differ (found for 'perm.score')
> 
> it seems to be putting TRAIT1 on the left side of the equation, and if I
> am wrong about that, the different lengths from the error is still not
> true:
> 
>> length(with(new3, perm.score))==length(with(new3, get(TRAIT1)))
> [1] TRUE
> 
> Any ideas on either what is going on, or how I can fix this?
> 
> ** I'm not including example data, or function because I am hoping it is
> not needed **
> Please let me know if I am wrong.
> 


--
View this message in context: http://r.789695.n4.nabble.com/problem-with-get-inside-of-lme-tp4629360p4629417.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list