runehaubo / old-lmerTest

**OLD** lmerTest version - see runehaubo/lmerTestR for the new one
2 stars 0 forks source link

step-function: Error in rbind(deparse.level, ...) #8

Closed jtorniainen closed 6 years ago

jtorniainen commented 6 years ago

Hi,

Problem: I was trying to build a model using lmer-function of the lme4/lmerTest-packages and then performing the backwards elimination on the model using the step-function. Everything works as expected when I type in the equation 'directly'. However, if I store the same equation in a string, run the model and then try the step-function I get the following error:

Error in rbind(deparse.level, ...) : 
  numbers of columns of arguments do not match

Snippet of the code I used:

model1 <- lmer(p2e ~ type + step + morph.pc.1 + morph.pc.2 + biochem.dry.pc.1 + biochem.dry.pc.2 + (1|id) + (1|bioc_test_no), data=dataset)
print('model 1 created')
formula2 = 'p2e ~ type + step + morph.pc.1 + morph.pc.2 + biochem.dry.pc.1 + biochem.dry.pc.2 + (1|id) + (1|bioc_test_no)'
model2 <- lmer(formula2, data=dataset)
print('model 2 created')
model1.stepped <- step(model)
print('model 1 step finished')
model2.stepped <- step(model2)
print('model 2 step finished')

R-output:

[1] "model 1 created"
[1] "model 2 created"
[1] "model 1 step finished"
Error in rbind(deparse.level, ...) : 
  numbers of columns of arguments do not match

According to sessionInfo() I was using: [1] lmerTest_3.0-1 lme4_1.1-17

runehaubo commented 6 years ago

Thank you for the bug report!

Could you try the development version of lmerTest:

devtools::install_github("runehaubo/lmerTestR")

If that does not solve the issue, please open another issue over at runehaubo/lmerTestR - not here; note the R in lmerTestR. If possible please provide a reproducible example or share the data privately so that I can reproduce the error.

Thanks, Rune