Index: Index

Description Usage Arguments Examples

Description

This function computes a mean-index or a sum-index for use in social sciences.

Usage

1
Index(items, type, max, min)

Arguments

items

The items you want to compute the index from. Has to be a data.frame.

type

mean will give you a mean-index, sum a sum-index

max

the maximum of allowed missings in a row

min

the minimum of non-missings in a row for which to compute the scale

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# generate data
set.seed(1234)
item1 <- rnorm(10, 2.5, .5)
item1[sample.int(length(item1), 2)] <- NA_real_
item2 <- rnorm(10, 3, .5)
item2[sample.int(length(item2), 3)] <- NA_real_
item3 <- rnorm(10, 2.2, .5)
item4 <- rnorm(10, 2, .5)
df1 <- data.frame(item1, item2, item3, item4)
df1
# compute different Indizes
Index(df1, type="mean", min=3)
Index(df1, type="mean", min=2)
Index(df1, type="sum")

tklebel/tkmisc documentation built on May 31, 2019, 3:44 p.m.