R/list2milist.R

Defines functions list2milist

Documented in list2milist

#'  Turns a list object with multiply imputed datasets into an object
#'   of class 'milist'.
#'
#' \code{list2milist} Turns a list with multiply imputed datasets
#'  into an object of class 'milist' to be further used by 'with.milist'
#'
#' @param data an object of class 'list'.
#'
#' @return an object of class 'milist'
#'
#' @author Martijn Heymans, 2021
#'
#' @export
list2milist <- function(data){
  if (!any(class(data)=="list"))
    stop("object must be of class 'list'")
  if (length(data)<2)
    stop("List must contain more than 1 imputed dataset")

  class(data) <- "milist"
  return(data)
}

Try the miceafter package in your browser

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

miceafter documentation built on Oct. 2, 2022, 5:08 p.m.