Description Usage Arguments Details Value Author(s) Examples
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.
1 |
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. |
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.
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.
Sebastian Weirich
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.