Quarto Reprex (via GitHub Actions on Linux)
The following reprex is from Quarto (via GitHub Actions on Linux):
Code
# Load libraries
library ("mice" )
Attaching package: 'mice'
The following object is masked from 'package:stats':
filter
The following objects are masked from 'package:base':
cbind, rbind
Code
# Impute data
imp <- mice:: mice (
nhanes,
maxit = 2 ,
m = 2 )
iter imp variable
1 1 bmi hyp chl
1 2 bmi hyp chl
2 1 bmi hyp chl
2 2 bmi hyp chl
Code
# Fit regression model to multiply imputed data
fit <- with (
data = imp,
exp = lm (bmi ~ hyp + chl))
# Pool results across models
fit_pooled <- mice:: pool (fit)
# Summarize pooled results
fit_pooled
Warning in `[<-.data.frame`(`*tmp*`, is_list, value = list(`3` = "<df[,11] [0 ×
11]>", : replacement element 1 has 1 row to replace 0 rows
Warning in `[<-.data.frame`(`*tmp*`, is_list, value = list(`3` = "<df[,11] [0 ×
11]>", : replacement element 2 has 1 row to replace 0 rows
Error:
! arguments imply differing number of rows: 1, 0
Code
Code
# Session Info
sessionInfo ()
R version 4.5.2 (2025-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
time zone: UTC
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mice_3.19.0
loaded via a namespace (and not attached):
[1] generics_0.1.4 tidyr_1.3.2 shape_1.4.6.1 lattice_0.22-7
[5] lme4_1.1-38 digest_0.6.39 magrittr_2.0.4 mitml_0.4-5
[9] evaluate_1.0.5 grid_4.5.2 iterators_1.0.14 fastmap_1.2.0
[13] foreach_1.5.2 jomo_2.7-6 jsonlite_2.0.0 glmnet_4.1-10
[17] Matrix_1.7-4 nnet_7.3-20 backports_1.5.0 survival_3.8-3
[21] purrr_1.2.0 codetools_0.2-20 reformulas_0.4.3.1 Rdpack_2.6.4
[25] cli_3.6.5 rlang_1.1.6 rbibutils_2.4 splines_4.5.2
[29] yaml_2.3.12 pan_1.9 tools_4.5.2 nloptr_2.2.1
[33] minqa_1.2.8 dplyr_1.1.4 boot_1.3-32 broom_1.0.11
[37] rpart_4.1.24 vctrs_0.6.5 R6_2.6.1 lifecycle_1.0.5
[41] MASS_7.3-65 pkgconfig_2.0.3 pillar_1.11.1 glue_1.8.0
[45] Rcpp_1.1.0 xfun_0.55 tibble_3.3.0 tidyselect_1.2.1
[49] knitr_1.51 htmltools_0.5.9 nlme_3.1-168 rmarkdown_2.30
[53] compiler_4.5.2
Reprex on Linux
The following reprex on Linux (via GitHub Actions) is from the output of reprex.R and is included via {{< include _includes/reprex.md >}}:
# Load libraries
library ("mice" )
#>
#> Attaching package: 'mice'
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following objects are masked from 'package:base':
#>
#> cbind, rbind
# Impute data
imp <- mice:: mice (
nhanes,
maxit = 2 ,
m = 2 )
#>
#> iter imp variable
#> 1 1 bmi hyp chl
#> 1 2 bmi hyp chl
#> 2 1 bmi hyp chl
#> 2 2 bmi hyp chl
# Fit regression model to multiply imputed data
fit <- with (
data = imp,
exp = lm (bmi ~ hyp + chl))
# Pool results across models
fit_pooled <- mice:: pool (fit)
# Summarize pooled results
fit_pooled
#> Class: mipo m = 2
#> term m estimate ubar b t dfcom
#> 1 (Intercept) 2 22.28519109 1.616971e+01 1.061756e+00 1.776235e+01 22
#> 2 hyp 2 -1.79588048 3.477708e+00 1.263331e+00 5.372705e+00 22
#> 3 chl 2 0.03554326 4.581421e-04 1.633595e-06 4.605925e-04 22
#> df riv lambda fmi
#> 1 16.048013 0.098494915 0.089663515 0.18524687
#> 2 4.981767 0.544898164 0.352708144 0.51490077
#> 3 20.120856 0.005348541 0.005320086 0.09136187
summary (fit_pooled)
#> term estimate std.error statistic df p.value
#> 1 (Intercept) 22.28519109 4.21453988 5.2876925 16.048013 7.288532e-05
#> 2 hyp -1.79588048 2.31790955 -0.7747845 4.981767 4.736174e-01
#> 3 chl 0.03554326 0.02146142 1.6561468 20.120856 1.132054e-01
# Session Info
sessionInfo ()
#> R version 4.5.2 (2025-10-31)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.3 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
#> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
#> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] mice_3.19.0
#>
#> loaded via a namespace (and not attached):
#> [1] generics_0.1.4 tidyr_1.3.2 shape_1.4.6.1 lattice_0.22-7
#> [5] lme4_1.1-38 digest_0.6.39 magrittr_2.0.4 mitml_0.4-5
#> [9] evaluate_1.0.5 grid_4.5.2 iterators_1.0.14 fastmap_1.2.0
#> [13] foreach_1.5.2 jomo_2.7-6 glmnet_4.1-10 Matrix_1.7-4
#> [17] nnet_7.3-20 backports_1.5.0 survival_3.8-3 purrr_1.2.0
#> [21] codetools_0.2-20 reformulas_0.4.3.1 Rdpack_2.6.4 cli_3.6.5
#> [25] rlang_1.1.6 rbibutils_2.4 splines_4.5.2 reprex_2.1.1
#> [29] withr_3.0.2 yaml_2.3.12 pan_1.9 tools_4.5.2
#> [33] nloptr_2.2.1 minqa_1.2.8 dplyr_1.1.4 boot_1.3-32
#> [37] broom_1.0.11 vctrs_0.6.5 R6_2.6.1 rpart_4.1.24
#> [41] lifecycle_1.0.5 fs_1.6.6 MASS_7.3-65 pkgconfig_2.0.3
#> [45] pillar_1.11.1 glue_1.8.0 Rcpp_1.1.0 xfun_0.55
#> [49] tibble_3.3.0 tidyselect_1.2.1 knitr_1.51 htmltools_0.5.9
#> [53] nlme_3.1-168 rmarkdown_2.30 compiler_4.5.2
Created on 2026-01-08 with reprex v2.1.1
Reprex on PC
The following reprex is from running the code locally on my PC:
# Load libraries
library ("mice" )
#>
#> Attaching package: 'mice'
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following objects are masked from 'package:base':
#>
#> cbind, rbind
# Impute data
imp <- mice:: mice (
nhanes,
maxit = 2 ,
m = 2 )
#>
#> iter imp variable
#> 1 1 bmi hyp chl
#> 1 2 bmi hyp chl
#> 2 1 bmi hyp chl
#> 2 2 bmi hyp chl
# Fit regression model to multiply imputed data
fit <- with (
data = imp,
exp = lm (bmi ~ hyp + chl))
# Pool results across models
fit_pooled <- mice:: pool (fit)
# Summarize pooled results
fit_pooled
#> Class: mipo m = 2
#> term m estimate ubar b t dfcom
#> 1 (Intercept) 2 18.88333656 1.701025e+01 6.5351430303 2.681296e+01 22
#> 2 hyp 2 -1.57916147 5.488783e+00 0.4312712039 6.135690e+00 22
#> 3 chl 2 0.05146973 5.190739e-04 0.0000684852 6.218017e-04 22
#> df riv lambda fmi
#> 1 4.727236 0.5762829 0.3655961 0.5297956
#> 2 15.072400 0.1178598 0.1054334 0.2044315
#> 3 11.563450 0.1979059 0.1652099 0.2798517
summary (fit_pooled)
#> term estimate std.error statistic df p.value
#> 1 (Intercept) 18.88333656 5.17812328 3.6467530 4.727236 0.01632623
#> 2 hyp -1.57916147 2.47703245 -0.6375215 15.072400 0.53335079
#> 3 chl 0.05146973 0.02493595 2.0640772 11.563450 0.06219456
# Session Info
sessionInfo ()
#> R version 4.5.2 (2025-10-31 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 11 x64 (build 26100)
#>
#> Matrix products: default
#> LAPACK version 3.12.1
#>
#> locale:
#> [1] LC_COLLATE=English_United States.utf8
#> [2] LC_CTYPE=English_United States.utf8
#> [3] LC_MONETARY=English_United States.utf8
#> [4] LC_NUMERIC=C
#> [5] LC_TIME=English_United States.utf8
#>
#> time zone: America/Chicago
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] mice_3.19.0
#>
#> loaded via a namespace (and not attached):
#> [1] generics_0.1.4 tidyr_1.3.2 shape_1.4.6.1 lattice_0.22-7
#> [5] lme4_1.1-38 digest_0.6.39 magrittr_2.0.4 mitml_0.4-5
#> [9] evaluate_1.0.5 grid_4.5.2 iterators_1.0.14 fastmap_1.2.0
#> [13] foreach_1.5.2 jomo_2.7-6 glmnet_4.1-10 Matrix_1.7-4
#> [17] nnet_7.3-20 backports_1.5.0 survival_3.8-3 purrr_1.2.0
#> [21] codetools_0.2-20 reformulas_0.4.3.1 Rdpack_2.6.4 cli_3.6.5
#> [25] rlang_1.1.6 rbibutils_2.4 splines_4.5.2 reprex_2.1.1
#> [29] withr_3.0.2 yaml_2.3.12 otel_0.2.0 pan_1.9
#> [33] tools_4.5.2 nloptr_2.2.1 minqa_1.2.8 dplyr_1.1.4
#> [37] boot_1.3-32 broom_1.0.11 rpart_4.1.24 vctrs_0.6.5
#> [41] R6_2.6.1 lifecycle_1.0.5 fs_1.6.6 MASS_7.3-65
#> [45] pkgconfig_2.0.3 pillar_1.11.1 glue_1.8.0 Rcpp_1.1.0
#> [49] xfun_0.55 tibble_3.3.0 tidyselect_1.2.1 rstudioapi_0.17.1
#> [53] knitr_1.51 htmltools_0.5.9 nlme_3.1-168 rmarkdown_2.30
#> [57] compiler_4.5.2
Created on 2026-01-08 with reprex v2.1.1