Skip to contents

Pivots the input dataframe so any pair name-level columns are transformed into columns (name) that contain values from the corresponding level.

Usage

splitAll(result, keep = FALSE, fill = "overall", exclude = "variable")

Arguments

result

A data.frame.

keep

Whether to keep the original name-level columns.

fill

A character that specifies what value should be filled in when missing.

exclude

Name of a column pair to exclude.

Value

A dataframe with group, strata and additional as columns.

Examples

mockSummarisedResult() |>
  splitAll()
#> # A tibble: 126 × 10
#>    result_id cdm_name cohort_name age_group sex     variable_name variable_level
#>        <int> <chr>    <chr>       <chr>     <chr>   <chr>         <chr>         
#>  1         1 mock     cohort1     overall   overall number subje… NA            
#>  2         1 mock     cohort1     <40       Male    number subje… NA            
#>  3         1 mock     cohort1     >=40      Male    number subje… NA            
#>  4         1 mock     cohort1     <40       Female  number subje… NA            
#>  5         1 mock     cohort1     >=40      Female  number subje… NA            
#>  6         1 mock     cohort1     overall   Male    number subje… NA            
#>  7         1 mock     cohort1     overall   Female  number subje… NA            
#>  8         1 mock     cohort1     <40       overall number subje… NA            
#>  9         1 mock     cohort1     >=40      overall number subje… NA            
#> 10         1 mock     cohort2     overall   overall number subje… NA            
#> # ℹ 116 more rows
#> # ℹ 3 more variables: estimate_name <chr>, estimate_type <chr>,
#> #   estimate_value <chr>