drizopoulos / GLMMadaptive

GLMMs with adaptive Gaussian quadrature
https://drizopoulos.github.io/GLMMadaptive/
59 stars 14 forks source link

mixed_model() throws an error if object's first class in order is "AsIs" 🤔 #26

Closed HRRMXJ closed 3 years ago

HRRMXJ commented 4 years ago

With example data:

DF <- I(DF)
fm1 <- mixed_model(y ~ sex * time, random = ~ 1 | id, data = DF, 
family = zi.poisson(), zi_fixed = ~ sex)
Error in `[.data.frame`(data, groups) : undefined columns selected
class(DF) <- class(DF)[c(2,1)]
fm1 <- mixed_model(y ~ sex * time, random = ~ 1 | id, data = DF, 
family = zi.poisson(), zi_fixed = ~ sex)
exists("fm1")
[1] TRUE
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] GLMMadaptive_0.6-8

loaded via a namespace (and not attached):
[1] MASS_7.3-51.4      compiler_3.6.1     parallel_3.6.1     tools_3.6.1        yaml_2.2.0         nlme_3.1-142       grid_3.6.1         matrixStats_0.55.0
[9] lattice_0.20-38
drizopoulos commented 3 years ago

Solved.