collapse {lordif} | R Documentation |
collapses response categories
Description
Collapses response categories if cell frequencies by group are below a minimum threshold specified by minCell and returns a vector of recoded responses.
Usage
collapse(resp, group, minCell)
Arguments
resp |
a vector of item responses |
group |
a vector of group designations |
minCell |
a minimum cell frequency |
Details
Collapses item response categories in resp if the two-way contingency table (resp x group) has cell frequencies less than the minimum cell count threshold specified by minCell.
Value
a numeric vector of the same length as resp with collapsed/recoded values.
Note
The lowest item response category/score should be coded as 1 not 0 (e.g., 1, 2, 3, 4, 5; and not 0, 1, 2, 3, 4). There must be at least two unique categories after collapsing/recoding.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
See Also
Examples
r1 <- c(1,1,2,1,1,2,2,1,2,2,1,2,2,1,1,2,1,2,2,3,3,1,2,3)
gr <- c(0,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1)
collapse(r1,gr,2) #minCell=2
## returns c(1,1,2,1,1,2,2,1,2,2,1,2,2,1,1,2,1,2,2,2,2,1,2,2)
## response categories 2 and 3 are collapsed
[Package lordif version 0.3-3 Index]