Skip to contents

This function transforms a "waterfall" data frame into a format where each cohort's values are aligned by their relative position in the cohort sequence. The transformation is useful for visualizing cohort data in a transposed format.

Usage

transpose_waterfall(waterfall)

Arguments

waterfall

A data frame where the first column (First) identifies the cohort and other columns represent values across different time periods or stages.

Value

A transposed data frame where each row corresponds to a cohort and columns represent sequential stages relative to the cohort.

Examples


waterfall <- elog_waterfall(elog_validated$elog)

transpose_waterfall(waterfall)
#> # A tibble: 54 × 49
#>    first   `0`   `1`   `2`   `3`   `4`   `5`   `6`   `7`   `8`   `9`  `10`  `11`
#>    <chr> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#>  1 2017…    59     7     4     1     1     1     2     2     1     3     1     3
#>  2 2017…    64     6     2     3     4     5     3     3     3     3     2     1
#>  3 2017…    66     6     5     1     1     1     4     3     1     1     2     1
#>  4 2017…    70     7     5     5     1     2     4     2     1     1     1     2
#>  5 2017…   118     6     6     4     4     9     4     3     3     3     3     3
#>  6 2017…    80     8     4     3     2     6     5     2     1     2     2     4
#>  7 2017…   150     6     4     4     5     8     5     3     4     2     5     2
#>  8 2017…   110    10     8     4     5     1     3     5     4     1     4     2
#>  9 2017…   117    14     8    10     7     2     2     5     1     3     4     3
#> 10 2017…   120     8     3     2     1     6     4     3     4     1     4     2
#> # ℹ 44 more rows
#> # ℹ 36 more variables: `12` <int>, `13` <int>, `14` <int>, `15` <int>,
#> #   `16` <int>, `17` <int>, `18` <int>, `19` <int>, `20` <int>, `21` <int>,
#> #   `22` <int>, `23` <int>, `24` <int>, `25` <int>, `26` <int>, `27` <int>,
#> #   `28` <int>, `29` <int>, `30` <int>, `31` <int>, `32` <int>, `33` <int>,
#> #   `34` <int>, `35` <int>, `36` <int>, `37` <int>, `38` <int>, `39` <int>,
#> #   `40` <int>, `41` <int>, `42` <int>, `43` <int>, `44` <int>, `45` <int>, …