Closed guoyi-smh closed 3 months ago
After some further investigation into this issue, I found that the reason for the error message was that when I ran the example above, the label
function call was calling the label
function in Hmisc
package, not the label()
function in table1
package (table1::label()
was masked by Hmisc::label
), and as a result, the variable would get a labelled
class, which caused the error. When table1::label()
funtion is used, it adds an attribute to the variable without changing the class.
Other than the modification in class
, the Hmisc::label()
also works well to add label attribute and it is compatible with table1
. Since Hmisc
is a a widely used package for EDA and other people might encounter this issue as well, in the fix I simply added one line to remove the labelled
class from the input. With this change, even when people uses the wrong label
function to add labels table1
still works.
New Feature Request
When using
table1()
to generate tables, it can be useful to label column names for better display in the output html table. e.g.Currently the
max_pairwise_smd
function will give error when the input column is labelled:Because it assumes the input column has only one class while labelled column can have two:
This can be improved by something like: