benjaminrich / table1

79 stars 26 forks source link

Inconsistency between table and total columns #80

Closed msanches35 closed 1 year ago

msanches35 commented 2 years ago

Hello! I want to thank you for the package which I use a lot!

I found that when there are missing values in the column variable, they are not displayed as a column, however, they are counted in the "Overall" column. It seems to me that to be consistent, the table should by default either show a missing column, or not add that column to the total count.

This is not hard to solve (by removing missing values from column variables, or by recoding missing into some non-missing value before creating the table), but I feel like as is it is inconsistent and may lead to mistakes in interpretation (like leading one to think there are no missing in the column variable when there are, because the total column adds up to the total sample).

Thank you!

Marcos

benjaminrich commented 2 years ago

Hi Marcos,

Thanks for you comments. I see your point. It was intended that the variable(s) used for stratification (i.e., columns) should not contain missing values. But this isn't clearly documented, and the function should at least issue a warning in this case. I'll try to improve that for the next version of the package. In the meantime, your workarounds are correct.

benjaminrich commented 1 year ago

I decided to make it an error, it's safer.

benjaminrich commented 1 year ago

Fixed in v1.4.3.