
Get a custom tidy visualization of a summarised_result object
Source:R/tidy.R
tidySummarisedResult.Rd
Arguments
- result
A summarised_result.
- splitGroup
If TRUE it will split the group name-level column pair.
- splitStrata
If TRUE it will split the group name-level column pair.
- splitAdditional
If TRUE it will split the group name-level column pair.
- settingsColumns
Settings to be added as columns, by default all settings will be added. If NULL or empty character vector, no settings will be added.
- pivotEstimatesBy
Names from which pivot wider the estimate values. If NULL the table will not be pivotted.
- nameStyle
Name style (glue package specifications) to customise names when pivotting estimates. If NULL standard tidyr::pivot_wider formatting will be used.
Examples
{
result <- mockSummarisedResult()
result |> tidySummarisedResult()
result |>
tidySummarisedResult(
settingsColumns =character(),
pivotEstimatesBy = c("variable_name", "variable_level", "estimate_name")
)
result |>
tidySummarisedResult(
settingsColumns =character(),
pivotEstimatesBy = c("variable_name", "variable_level", "estimate_name"),
nameStyle = "{estimate_name}_{variable_name}_{variable_level}"
)
}
#> # A tibble: 18 × 12
#> result_id cdm_name cohort_name age_group sex `count_number subjects`
#> <int> <chr> <chr> <chr> <chr> <int>
#> 1 1 mock cohort1 overall overall 3757580
#> 2 1 mock cohort1 <40 Male 1368529
#> 3 1 mock cohort1 >=40 Male 986021
#> 4 1 mock cohort1 <40 Female 6423973
#> 5 1 mock cohort1 >=40 Female 8174897
#> 6 1 mock cohort1 overall Male 1567231
#> 7 1 mock cohort1 overall Female 5118733
#> 8 1 mock cohort1 <40 overall 7105515
#> 9 1 mock cohort1 >=40 overall 3634426
#> 10 1 mock cohort2 overall overall 6686055
#> 11 1 mock cohort2 <40 Male 7204168
#> 12 1 mock cohort2 >=40 Male 5419602
#> 13 1 mock cohort2 <40 Female 3933305
#> 14 1 mock cohort2 >=40 Female 3998490
#> 15 1 mock cohort2 overall Male 2749445
#> 16 1 mock cohort2 overall Female 1644105
#> 17 1 mock cohort2 <40 overall 8670615
#> 18 1 mock cohort2 >=40 overall 6532899
#> # ℹ 6 more variables: mean_age <dbl>, sd_age <dbl>,
#> # count_Medications_Amoxiciline <int>,
#> # percentage_Medications_Amoxiciline <dbl>,
#> # count_Medications_Ibuprofen <int>, percentage_Medications_Ibuprofen <dbl>