-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Support for checkbox questions #79
Comments
This comment has been minimized.
This comment has been minimized.
@svenhalvorson thank you for the post! I've transferred this issue to our bstfun package, which (among other purposes) serves as a sandbox for gtsummary features. I was thinking the interface to the function will be similar to df <-
tibble::tibble(
race_white = sample(c(T, F), 10, replace = TRUE),
race_black = sample(c(T, F), 10, replace = TRUE),
race_asian = sample(c(T, F), 10, replace = TRUE),
)
tbl_check_all_that_apply(
data = df,
include = list("Race" = c(race_white, race_black, race_asian))
) We would require that the variables included be logical (to ensure they can be summarized on a single row). Do you have any suggestions for the function name? |
This comment has been minimized.
This comment has been minimized.
tbl_checks |
@ddsjoberg thanks for continuing with this. As far as name goes, I think these kinds of variables are widely referred to as 'checkbox' questions and that is shorter than A couple other thoughts:
|
Great, we'll leave it up to the user to differentiate between uncheck and missing, by requiring logical class variables.
Unfortunately, I think you're going to be left with stacking the |
Hey hey @svenhalvorson I added a draft of the function in this pull request #81 How familiar are you with GitHub and Pull Requests? Are you able to install the branch with the |
Pinging @svenhalvorson @kwakuduahc1 , can either of you review this pull request with the added function? #81 |
I'm frequently using data sets that have 'checkbox' style questions in which the respondent selects any number of some set of discrete options. The resulting data is then spread across multiple columns, one for each option, and will just have a
1
orNA
for possible values.The function
gtsummary::tbl_summary
treats these each as their own variable instead of listing a common heading for them. Here is my question from stackoverflow along with @ddsjoberg 's solution. This solution is okay but it's a bit tedious, especially if you have a lot of other variables in the data set.Ideally,
gtsummary::tbl_summary
could be given a list of columns to treat as one question or a pattern to find them, and then apply this similar formatting.Thank you! Love the library
The text was updated successfully, but these errors were encountered: