GEMINI-Medicine / Rgemini

A custom R package that provides a variety of functions to perform data analyses with GEMINI data
https://gemini-medicine.github.io/Rgemini/
Other
3 stars 0 forks source link

[BUG]:`disability()` returns extra encounters not in cohort when component_wise is set to TRUE #103

Closed gemini-wenb closed 4 months ago

gemini-wenb commented 6 months ago

Please identify the affected function:

disability()

[minimal reproducible example] that demonstrates the incorrect behaviour in the function above:

cwf = disability(admdad, ipdiag, erdiag )
cwt = disability(admdad, ipdiag, erdiag, component_wise = T )

## number of unique encounters do not match up.
lunique(cwf[disability==T,]$genc_id) 
lunique(cwt$genc_id) #extra encounters when component_wise=T

Please list (if known), any impact to research projects, or internal tools/processes:

Suggested fix: This bug can be fixed by restricting output genc_id to only those found in the input cohort, just like how it is done when component_wise is set to False: image

For the developer: Once the bug is resolved, please add the reproducible example above as a test in the tests/testthat directory.

Any suggested developers?

Any suggested reviewers?

*