Skip to contents

[Experimental] Pivot the estimates as new columns in result table.

Usage

pivotEstimates(result, pivotEstimatesBy = "estimate_name", nameStyle = NULL)

Arguments

result

A summarised_result.

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.

Value

A tibble.

Examples

result <- mockSummarisedResult()
result |> pivotEstimates()
#> # A tibble: 72 × 14
#>    result_id cdm_name group_name  group_level strata_name       strata_level   
#>        <int> <chr>    <chr>       <chr>       <chr>             <chr>          
#>  1         1 mock     cohort_name cohort1     overall           overall        
#>  2         1 mock     cohort_name cohort1     age_group &&& sex <40 &&& Male   
#>  3         1 mock     cohort_name cohort1     age_group &&& sex >=40 &&& Male  
#>  4         1 mock     cohort_name cohort1     age_group &&& sex <40 &&& Female 
#>  5         1 mock     cohort_name cohort1     age_group &&& sex >=40 &&& Female
#>  6         1 mock     cohort_name cohort1     sex               Male           
#>  7         1 mock     cohort_name cohort1     sex               Female         
#>  8         1 mock     cohort_name cohort1     age_group         <40            
#>  9         1 mock     cohort_name cohort1     age_group         >=40           
#> 10         1 mock     cohort_name cohort2     overall           overall        
#> # ℹ 62 more rows
#> # ℹ 8 more variables: variable_name <chr>, variable_level <chr>,
#> #   additional_name <chr>, additional_level <chr>, count <int>, mean <dbl>,
#> #   sd <dbl>, percentage <dbl>