Skip to content
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

inline_text.tbl_summary() update with pattern argument #254

Closed
ddsjoberg opened this issue Oct 20, 2019 · 0 comments
Closed

inline_text.tbl_summary() update with pattern argument #254

ddsjoberg opened this issue Oct 20, 2019 · 0 comments
Assignees
Labels
enhancement 🌟 New feature or request
Milestone

Comments

@ddsjoberg
Copy link
Owner

ddsjoberg commented Oct 20, 2019

For a typical project, I need a Table 1 describing the patient population where I'll report, for example, the median IQR for age. Currently, the inline_text.tbl_summary() function can only print exactly what appears in the table, e.g. 4.5 (3.0, 6.7). But I often want to print just the median, or for categorical I"ll only want to print n or the percent.

I would like to introduce a pattern argument where we can grab any statistic from the table. This will require a large update to tbl_summary(). One possible solution is to return a column in the meta_data tibble that is a tibble containing the individual statistics.

Here's an example of the meta_data table and a print of the last column containing the statistics. (Perhaps in the update process we add in the ability to not only round to integer values, but use a rounding function?)

# A tibble: 2 x 6
  variable class   summary_type var_label stat_display        df_stats     
  <chr>    <chr>   <chr>        <chr>     <chr>               <list>       
1 age      numeric continuous   Age, yrs  {median} ({p25}, {~ <tibble [1 x~
2 grade    factor  categorical  Grade     {n} ({p}%)          <tibble [3 x~
[[1]]
# A tibble: 1 x 3
  median   p25   p75
   <dbl> <dbl> <dbl>
1   46.3  37.2  56.8

[[2]]
# A tibble: 3 x 3
      n     N     p
  <dbl> <dbl> <dbl>
1    67   200 0.335
2    58   200 0.290
3    75   200 0.375

Created on 2019-10-20 by the reprex package (v0.3.0)

@ddsjoberg ddsjoberg added the enhancement 🌟 New feature or request label Oct 27, 2019
@ddsjoberg ddsjoberg self-assigned this Oct 27, 2019
@ddsjoberg ddsjoberg added this to the v1.3.0 milestone Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🌟 New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant