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

chuck.01 CharlieTheBrown77 at gmail.com
Sat May 12 21:46:11 CEST 2012


Hi, 
 In 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
wong about that, this is still not true:

length(with(new3, perm.score))==length(with(new3, get(TRAIT1)))

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-tp4629360.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list