beckerbenj / beckerbenj/eatCodebook
`createInputForDescriptives()` - identify items based on `group`, not by `label`
- Dominant language
- R
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The argument `itemExpr` identifies the items of a scale by looking for the word `Indikator` in the label. BT labels usually don't have that. So scale items get the `type` `variable` instead of `item`.
My workaround was identifying every `scale` entry (without imputated variables/scales), saving the `group` names and then looking for entries that match the group name, but that have `variable` written in `type`; and then change that to `item`.
``` r
### Hotfix: change scale items from "variable" to "item"
# for data sets with pooled/imputated variables
group <- grep("_pooled", descriptives_sus[descriptives_sus$type == "scale",]$group, invert = TRUE, value = TRUE)
for(var in group){
descriptives_sus[descriptives_sus$group == var & descriptives_sus$type == "variable",]$type <- "item"
}
# for data sets without pooled/imputated variables
group <- descriptives_lfb_allg[descriptives_lfb_allg$type == "scale",]$group
for(var in group){
descriptives_lfb_allg[descriptives_lfb_allg$group == var & descriptives_lfb_allg$type == "variable",]$type <- "item"
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting createInputForDescriptives() and how itemExpr uses labels containing "Indikator" to assign types. Reproduce the scale-item case described in the issue, then verify that entries sharing a scale's group are classified as type "item" rather than "variable", including pooled or imputed data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100