Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

missing_pattern

Characterise missing data for finalfit models


Description

Using finalfit conventions, produces a missing data matrix using md.pattern.

Usage

missing_pattern(.data, dependent = NULL, explanatory = NULL,
  rotate.names = TRUE, ...)

Arguments

.data

Data frame. Missing values must be coded NA.

dependent

Character vector usually of length 1, name of depdendent variable.

explanatory

Character vector of any length: name(s) of explanatory variables.

rotate.names

Logical. Should the orientation of variable names on plot should be vertical.

...

pass other arguments such as plot = TRUE to md.pattern.

Value

A matrix with ncol(x)+1 columns, in which each row corresponds to a missing data pattern (1=observed, 0=missing). Rows and columns are sorted in increasing amounts of missing information. The last column and row contain row and column counts, respectively.

Examples

library(finalfit)
library(dplyr)
explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "mort_5yr"

colon_s %>%
	missing_pattern(dependent, explanatory)

finalfit

Quickly Create Elegant Regression Results Tables and Plots when Modelling

v1.0.2
MIT + file LICENCE
Authors
Ewen Harrison [aut, cre], Tom Drake [aut], Riinu Ots [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.