Closed ddsjoberg closed 2 years ago
Thanks @ddsjoberg for the proposal.
Some thoughts about potential functionalities for discussion.
If all factors do not have the same levels, instead of a stop, we could harmonize the level with forcats::fct_unify()
and display a message.
We could add some methods add_n()
and add_missing()
to display the number of observations and missing observations.
A method add_score()
to present some summary statistic by considering the variables as continuous. By default, I would suggest to display statistic = "{mean} ({sd})"
. In addition, it would be important to have an argument score_values
to indicate how to transform the factor into a score. If NULL
, simply use as.integer(data[[variable]])
. If provided (e.g. -2:2
for a five levels scales), using score_values[as.integer(data[[variable]])]
.
Can we also think about a group
option (for example group = "sex")
to compute the likert table by sub-group and then to stack them?
add_overall()
for displaying a total 100% column?
Would it be difficult to have an option or a method to order the table based on mean score?
Should we fix missing = "no" when calling tbl_summary() and display the number of missing through a method add_missing() ?
Should we fix missing = "no" when calling tbl_summary() and display the number of missing through a method add_missing() ?
We could add it, but the "variable" being summarized in "...all_true..."
, which has no missing values. The missing values are auto-dropped because it's the by=
variable.
Would it be difficult to have an option or a method to order the table based on mean score?
That shouldn't be too bad!
add_overall() for displaying a total 100% column?
I am not sure I know what you have in mind here.
A method add_score() to present some summary statistic by considering the variables as continuous.
This can be added. But perhaps not a priority, as a user can easily create the continuous summary then merge it with the likert table.
Can we also think about a group option (for example group = "sex") to compute the likert table by sub-group and then to stack them?
This wouldn't be difficult to implement with tbl_strata()
. I would imagine users would want to control whether the tbls are stacked or merged. It can be added, but i'll prioritize the other items first....need to think about best implementation.
closes #53
add_n()
method.forcats::fct_unify()