Description Usage Arguments Examples
This function computes a mean-index or a sum-index for use in social sciences.
1 |
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 |
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.