R/mids2mitml.list.R

Defines functions mids2mitml.list

Documented in mids2mitml.list

mids2mitml.list <- function(x){
# convert mids to mitml.list

  if(!requireNamespace("mice", quietly = TRUE)) stop("The 'mice' package must be installed to use this function.")
  m <- x$m

  out <- list()
  length(out) <- m
  for(ii in 1:m){
    out[[ii]] <- mice::complete(x, action = ii)
  }

  class(out) <- c("mitml.list", "list")
  return(out)

}

Try the mitml package in your browser

Any scripts or data that you put into this service are public.

mitml documentation built on Jan. 6, 2023, 5:17 p.m.