rowscore: Create scores

Description Usage Arguments Value Examples

Description

Create scores: mean or if any of the variables have specific values.

Usage

1
rowscore(dat, vars, type = "mean", p = 1/2, nitems = NULL, val = NULL)

Arguments

dat

data.table or data.frame.

vars

Character vector with name of variables.

type

Type of score (mean, any, parcel). parcel selects items based on p. Once the items are selected the average with the available items is computed.

p

Proportion of items with valid values to compute the average.

nitems

Number of items with valid values to compute the average.

values

Values used to define any index

Value

Returns a vector with scores.

Examples

1
2
3
4
5
6
a <- c(NA,2,3,4, NA)
b <- c(2,3,4,NA, 3)
c <- c(1,2,3,NA, 1)
dat <- data.table(a,b,c)
vars <- names(dat)
rowscore(dat, vars)

sdaza/sdazar documentation built on May 29, 2019, 4:20 p.m.