This utility function decomposes item names into components: instrument, domain, mode and number

decompose_itemnames(x)

Arguments

x

A character vector containing item names (gsed lexicon)

Value

A data.frame with length(x) rows and four columns, named: instrument, domain, mode, and number.

Details

The gsed-naming convention is as follows. Position 1-3 codes the instrument, position 4-5 codes the domain, position 6 codes direct/caregiver/message, positions 7-9 is a item sequence number.

See also

Author

Stef van Buuren

Examples

itemnames <- c("aqigmc028", "grihsd219", "", "by1mdd157", "mdsgmd006")
decompose_itemnames(itemnames)
#>   instrument domain mode number
#> 1        aqi     gm    c    028
#> 2        gri     hs    d    219
#> 3                              
#> 4        by1     md    d    157
#> 5        mds     gm    d    006