pivotImp: Pivot imputed data

View source: R/pivotImp.R

pivotImpR Documentation

Pivot imputed data

Description

This function takes a 'mids' object, generated by package 'mice', and creates a data frame with one long column for all imputed values, a column indicating the corresponding value of the predictor variable, and a column indicating to which of the 'm' imputed datasets it belongs. This function is useful for time-series data, where predictor variable (time) is complete and response variable values are missing.

Usage

pivotImp(mids, data, xVarName, yVarName)

Arguments

mids

A 'mids' object generated by 'mice'

data

Original dataset with missing values

xVarName

A character string with the name of the predictor variable in the original dataset

yVarName

A character string with the name of the response variable in the 'mids' object

Value

A data frame with three columns


earlycapistran/consLettersUtils documentation built on Nov. 22, 2022, 1:22 a.m.