Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error when running summary() on lme4 object (Error in diag(from, names = FALSE) : object 'unpackedMatrix_diag_get' not found)

I am unable to get a summary() of a lme4 model. Whenever I run the summary function of an lme4 object, I get the error:

Error in diag(from, names = FALSE) : object ‘unpackedMatrix_diag_get’ not found

I am unable to trace the issue, so have written code below that generates the error and included all the packages that are loaded directly into the code. Note. the model won’t converge, but I get the same error for converged models.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel


# packages
library(tidyverse)
library(kableExtra)
library(psych)
library(lavaan)
library(semPlot)
library(qpcR)
library(brms)
library(lme4)

partid <- c("A","B","C","D","A","B","C","D") 
count <- c(13, 41, 33, 37, 60, 41, 41, 39) 
side <- c("L","L","L","L","R","R","R","R") 

dat <- data.frame(partid, count, side)

mod <- lme4::lmer(count~ side + (1 | partid)) 
summary(mod)

Here is the output from sessionInfo():

R version 4.3.3 (2024-02-29)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: Europe/London
tzcode source: internal

attached base packages:
stats     
graphics  
grDevices 
utils     
datasets  
methods   
base     

other attached packages:
lme4_1.1-35.3     
brms_2.21.0       
Rcpp_1.0.12       
qpcR_1.4-1        
Matrix_1.6-5      
robustbase_0.99-2
rgl_1.3.1         
minpack.lm_1.2-4  
MASS_7.3-60.0.1   
semPlot_1.1.6     
lavaan_0.6-17     
psych_2.4.3      
kableExtra_1.4.0  
lubridate_1.9.3   
forcats_1.0.0     
stringr_1.5.1     
dplyr_1.1.4       
purrr_1.0.2      
readr_2.1.5       
tidyr_1.3.1       
tibble_3.2.1      
ggplot2_3.5.0     
tidyverse_2.0.0  

loaded via a namespace (and not attached):
tensorA_0.36.2.1       
rstudioapi_0.16.0      
jsonlite_1.8.8         
magrittr_2.0.3         
nloptr_2.0.3          
rmarkdown_2.26         
vctrs_0.6.5            
minqa_1.2.6            
base64enc_0.1-3        
rstatix_0.7.2         
htmltools_0.5.8.1      
distributional_0.4.0   
broom_1.0.5            
Formula_1.2-5          
StanHeaders_2.32.6    
htmlwidgets_1.6.4      
plyr_1.8.9             
igraph_2.0.3           
lifecycle_1.0.4        
pkgconfig_2.0.3       
R6_2.5.1               
fastmap_1.1.1          
OpenMx_2.21.11         
digest_0.6.35          
fdrtool_1.2.17        
colorspace_2.1-0       
Hmisc_5.1-2            
ggpubr_0.6.0           
fansi_1.0.6            
timechange_0.3.0      
abind_1.4-5            
compiler_4.3.3         
withr_3.0.0            
glasso_1.11            
htmlTable_2.4.2       
backports_1.4.1        
inline_0.3.19          
carData_3.0-5          
QuickJSR_1.1.3         
pkgbuild_1.4.4        
ggsignif_0.6.4         
corpcor_1.6.10         
gtools_3.9.5           
loo_2.7.0              
tools_4.3.3           
pbivnorm_0.6.0         
foreign_0.8-86         
zip_2.3.1              
nnet_7.3-19            
glue_1.7.0            
quadprog_1.5-8         
nlme_3.1-164           
lisrelToR_0.3          
grid_4.3.3             
checkmate_2.3.1       
cluster_2.1.6          
reshape2_1.4.4         
generics_0.1.3         
gtable_0.3.4           
tzdb_0.4.0            
data.table_1.15.4      
hms_1.1.3              
xml2_1.3.6             
car_3.1-2              
utf8_1.2.4            
sem_3.1-15             
pillar_1.9.0           
rockchalk_1.8.157      
posterior_1.5.0        
splines_4.3.3         
lattice_0.22-5         
kutils_1.73            
tidyselect_1.2.1       
pbapply_1.7-2          
knitr_1.45            
gridExtra_2.3          
svglite_2.1.3          
stats4_4.3.3           
xfun_0.43              
bridgesampling_1.1-2  
qgraph_1.9.8           
arm_1.14-4             
matrixStats_1.3.0-9001 
DEoptimR_1.1-3         
rstan_2.32.6          
stringi_1.8.3          
yaml_2.3.8             
boot_1.3-29            
evaluate_0.23          
codetools_0.2-19      
mi_1.1                 
buildmer_2.11          
cli_3.6.2              
RcppParallel_5.1.7     
rpart_4.1.23          
xtable_1.8-4           
systemfonts_1.0.6      
munsell_0.5.1          
coda_0.19-4.1          
png_0.1-8             
XML_3.99-0.16.1        
parallel_4.3.3         
rstantools_2.4.0       
jpeg_0.1-10            
bayesplot_1.11.1      
Brobdingnag_1.2-9      
viridisLite_0.4.2      
mvtnorm_1.2-4          
scales_1.3.0           
openxlsx_4.2.5.2      
rlang_1.1.3            
mnormt_2.1.1  

I have tried resolving by reinstalling lme4 and Matrix in case they were causing this but no luck.

>Solution :

I believe it’s the buildmer package that is out of sync with Matrix. This previously came up on the lme4 issues list and was stated to be a problem with buildmer. There doesn’t seem to be anything on the buildmer issues list

I ran the following code from a clean R session:

library(lme4)
m1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy)
summary(m1)
library(buildmer)
m2 <- buildmer(Reaction ~ Days + (1|Subject), sleepstudy)

which ended with

Error in diag(from, names = FALSE) :
object ‘unpackedMatrix_diag_get’ not found
Error in tmp@call :
no applicable method for @ applied to an object of class "try-error"

I then reinstalled buildmer from source, restarted R, and was able to run the example without a problem.

Your example also works for me, after reinstalling buildmer. (I didn’t try it before reinstalling and am too lazy to go back and install a mismatched Matrix/buildmer pair to see if I can replicate the error …)

It’s not really clear to me how you got buildmer loaded (I see it in your sessionInfo() output, but it doesn’t appear when I load just the packages you specified in your example …)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading