aggregateData: Aggregate variables to items and/or scales.

Description Usage Arguments Details Value Author(s) Examples

View source: R/eatModel.r

Description

This is the old version of aggregateData from the eatPrep package. The function actually is deprecated and might only be used if aggregation information from the IQB database is not available.

Usage

1
aggregateData (all.daten,spalten, unexpected.pattern.as.na = TRUE, verboseAll = FALSE )

Arguments

all.daten

A data frame in the wide format with at least two (dichotomous) variable columns.

spalten

Column names or numbers with variables to aggregate

unexpected.pattern.as.na

Logical: TRUE, if non-valid patterns should be aggregated to NA.

verboseAll

Logical: Specifies whether exhaustive aggregation information shoul be printed on console.

Details

The funtion use a rather simple aggregation rule: all variables which share a common “stem” are considered to belong together. The “stem” is everything except the last sign. The item is considered to be correct if all variables are correct. See examples for further details.

Value

A list. First element is a data frame with sum scores. Second element is a data frame with aggregated scores. Third element is a data frame with information how many variables are summarizeds for each item.

Author(s)

Sebastian Weirich

Examples

1
2
3
4
5
6
### create artificial data
dat <- data.frame ( id = paste0("P", 11:50),
       matrix(data = sample(x=0:1, size = 400, replace = TRUE),nrow=40, ncol = 10))
### aggregate Item 0+1+2 and 4+5 and 8+9: define sequential letter
colnames(dat)[-1] <- c("I1a", "I1b", "I1c", "I2a", "I3a", "I3b", "I4a", "I5a", "I6a", "I6b")
agg <- aggregateData(dat, -1)

eatModel documentation built on May 2, 2019, 6:49 p.m.