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]: `big.mark` formatting in `cell_suppression` does not work correctly for categorical variables #67

Closed loffleraSMH closed 3 months ago

loffleraSMH commented 8 months ago

Affected function: render_cell_suppression.categorical()

There seems to be a small bug resulting in big.mark = "," not being applied correctly.

Example: When running this code, the thousands separator is only applied to continuous & missing variables, but not to categorical variables.

df <- data.table(income = c(rep(60000, 10000), rep(NA, 1000)), 
                 sex = c(rep("F", 5000), rep("M", 5000), rep(NA, 1000)))

table1(~ sex + income, 
       data = df,
       render.categorical = render_cell_suppression.categorical,
       render.continuous = render_cell_suppression.continuous,
       digits = 1,
       big.mark=","
)

table1

This seems to be a problem with render_cell_suppression.categorical. This code results in the expected output:

table1(~ sex + income, 
       data = df,
       #render.categorical = render_cell_suppression.categorical,
       render.continuous = render_cell_suppression.continuous,
       digits = 1,
       big.mark=","
)

table1_2