di-di: This function calculates the Deficit Index (DI) and returns...

Description Usage Arguments Value Examples

Description

This function calculates the Deficit Index (DI) and returns results as list: di a column-vector containing deficit indexes for each individual and columns that were used to calculate the di.

Usage

1
2
3
di(dat, cols = NULL, invert = NULL, rescale = TRUE, age = NULL,
  rescale.custom = NULL, rescale.avoid = NULL, bins = 7,
  visible = FALSE)

Arguments

dat

A data frame. Required parameter.

cols

A list of column names. Default: NULL.

invert

A list of columns which have to be inverted. Default: NULL.

rescale

A flag that tell the program to rescale columns if the values a not 0/1. Default: TRUE.

age

A name of column which represents age of a patient. Default: NULL.

rescale.custom

A custom rescaling. See example below. Default: NULL.

rescale.avoid

A set of column names for which rescaling should be avoided. Default: NULL.

bins

A number of bins for plotting the DI against age from a dataset. Default: 7.

visible

A flag to show DI plot (mean DI in a population by age) Default: FALSE

Value

A list of two: di a column-vector containing deficit indexes for each individual and columns (rescaled if flag rescale was set to TRUE) that were used to calculate the di.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(di)
dd <- data.frame(subj=seq(1:100), 
                 var1=rbinom(100,1,.5), 
                 var2=rbinom(100,1,.5), 
                 var3=rbinom(100,1,.5))
ddi <- di(dd, c("var1", "var2", "var3"))

# Cusom rescaling
ddi <- di(dd, c("var1", "var2", "var3"), rescale.custom=c("var1:0.1:0.5"))
ddi

di documentation built on May 2, 2019, 2:42 p.m.