Skip to contents

Segment breakdown is essentially a segment percentage summary for each model.

Usage

rack_extract_segment_breakdown(rack, type = c("wide", "tall"))

Arguments

rack

A model rack object for segmentation models.

type

If "wide" (default), return breakdown in a "wide" table format - models in rows, segments in columns and 0-1 proportions on intersections. "tall" format is more useful if you want to do some further calculations using segment percentages.

Examples

rack_extract_segment_breakdown(example_seg_rack)
#> # A tibble: 3 × 6
#>   model_name   `1`   `2`   `3`    `4`     `5`
#>   <fct>      <dbl> <dbl> <dbl>  <dbl>   <dbl>
#> 1 nmf_3      0.231 0.484 0.285 NA     NA     
#> 2 nmf_4      0.211 0.411 0.202  0.176 NA     
#> 3 nmf_5      0.178 0.302 0.158  0.263  0.0992
rack_extract_segment_breakdown(example_seg_rack, type = "tall")
#> # A tibble: 12 × 5
#>    model_name segment     n      p perc_chr
#>    <fct>      <fct>   <dbl>  <dbl> <chr>   
#>  1 nmf_3      1        23.7 0.231  23.08%  
#>  2 nmf_3      2        49.6 0.484  48.42%  
#>  3 nmf_3      3        29.2 0.285  28.50%  
#>  4 nmf_4      1        21.6 0.211  21.11%  
#>  5 nmf_4      2        42.2 0.411  41.12%  
#>  6 nmf_4      3        20.7 0.202  20.19%  
#>  7 nmf_4      4        18.0 0.176  17.58%  
#>  8 nmf_5      1        18.2 0.178  17.77%  
#>  9 nmf_5      2        31.0 0.302  30.22%  
#> 10 nmf_5      3        16.2 0.158  15.77%  
#> 11 nmf_5      4        27.0 0.263  26.32%  
#> 12 nmf_5      5        10.2 0.0992 9.92%