| stack_imputations | R Documentation |
Concatenates a list of imputed data frames into a single "stacked" data
frame. An imputation index column (.imp) is added to identify which
imputed dataset each row originated from. This is the first step of the
stacked-imputation workflow described in Rodgers et al. (2021) and
applied to conditional inference trees in Sherlock et al. (2026).
stack_imputations(data_list, imp_col = ".imp")
data_list |
A list of data frames, each the same dimensions, representing M imputed versions of the same dataset. |
imp_col |
Character string. Name of the imputation-index column
added to the stacked data (default |
A single data frame with M * n rows, where n is the number
of rows in each imputed dataset.
Sherlock, P., et al. (2026). Beyond linear risk: A machine learning approach to understanding perinatal depression in context. Multivariate Behavioral Research, 1-16. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00273171.2026.2661244")}
Rodgers, D. M., Jacobucci, R., & Grimm, K. J. (2021). A multiple imputation approach for handling missing data in classification and regression trees. Journal of Behavioral Data Science, 1(1), 127-153. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.35566/jbds/v1n1/p6")}
df1 <- data.frame(x = 1:5, y = c(2, 4, 6, 8, 10))
df2 <- data.frame(x = 1:5, y = c(2, 3, 6, 9, 10))
stacked <- stack_imputations(list(df1, df2))
nrow(stacked) # 10
table(stacked$.imp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.