insightsengineering / cards

CDISC Analysis Results Data
https://insightsengineering.github.io/cards/
30 stars 2 forks source link

More `ard_categorical()` efficiencies 😿 #176

Open ddsjoberg opened 7 months ago

ddsjoberg commented 7 months ago

I was fixing an edge-case bug in ard_categorical() when the variable was all NA. To correct this, I made an update to the way the denominator N was calculated. After the update, there is now a space for an efficiency gain when denominator = c("column", "row", "cell"), the most common cases.

  1. Instead of handling denominator = c("column", "row", "cell") entirely separately, we can instead include useNA="always" for the primary variable tabulation, then calculate the Ns by performing a grouped sum of "n".
  2. The other cases allowed in denominator will still be handled in the same way they are now. But as these are less common calculations, I expect an overall gain in efficiency.