Skip to contents

Unnest product- and company-level results

Usage

unnest_product(data)

unnest_company(data)

Arguments

data

A nested data frame, e.g. the output of sector_profile().

Value

A data frame.

See also

Other helpers: exclude(), jitter_range(), join_to(), summarize_range()

Examples

library(tiltToyData)
library(readr)
options(readr.show_col_types = FALSE)

companies <- read_csv(toy_sector_profile_companies())
scenarios <- read_csv(toy_sector_profile_any_scenarios())

both <- sector_profile(companies, scenarios)
both
#> # A tibble: 72 × 3
#>    companies_id                       product           company          
#>  * <chr>                              <list>            <list>           
#>  1 antimonarchy_canine                <tibble [4 × 10]> <tibble [16 × 3]>
#>  2 celestial_lovebird                 <tibble [4 × 10]> <tibble [16 × 3]>
#>  3 nonphilosophical_llama             <tibble [8 × 10]> <tibble [16 × 3]>
#>  4 asteria_megalotomusquinquespinosus <tibble [4 × 10]> <tibble [16 × 3]>
#>  5 quasifaithful_amphiuma             <tibble [4 × 10]> <tibble [16 × 3]>
#>  6 spectacular_americanriverotter     <tibble [4 × 10]> <tibble [16 × 3]>
#>  7 contrite_silkworm                  <tibble [4 × 10]> <tibble [16 × 3]>
#>  8 harmless_owlbutterfly              <tibble [4 × 10]> <tibble [16 × 3]>
#>  9 fascist_maiasaura                  <tibble [4 × 10]> <tibble [16 × 3]>
#> 10 charismatic_islandwhistler         <tibble [4 × 10]> <tibble [16 × 3]>
#> # ℹ 62 more rows

both |> unnest_product()
#> # A tibble: 304 × 11
#>    companies_id           grouped_by     risk_category profile_ranking clustered
#>    <chr>                  <chr>          <chr>                   <dbl> <chr>    
#>  1 antimonarchy_canine    ipr_1.5C RPS_… medium                   0.18 tent     
#>  2 antimonarchy_canine    ipr_1.5C RPS_… high                     0.98 tent     
#>  3 antimonarchy_canine    weo_NZ 2050_2… high                     0.4  tent     
#>  4 antimonarchy_canine    weo_NZ 2050_2… high                     0.97 tent     
#>  5 celestial_lovebird     ipr_1.5C RPS_… medium                   0.18 table hi…
#>  6 celestial_lovebird     ipr_1.5C RPS_… high                     0.98 table hi…
#>  7 celestial_lovebird     weo_NZ 2050_2… high                     0.4  table hi…
#>  8 celestial_lovebird     weo_NZ 2050_2… high                     0.97 table hi…
#>  9 nonphilosophical_llama ipr_1.5C RPS_… low                      0.09 surface …
#> 10 nonphilosophical_llama ipr_1.5C RPS_… high                     0.95 surface …
#> # ℹ 294 more rows
#> # ℹ 6 more variables: activity_uuid_product_uuid <chr>, tilt_sector <chr>,
#> #   scenario <chr>, year <dbl>, type <chr>, tilt_subsector <chr>

both |> unnest_company()
#> # A tibble: 1,152 × 4
#>    companies_id        grouped_by        risk_category value
#>    <chr>               <chr>             <chr>         <dbl>
#>  1 antimonarchy_canine ipr_1.5C RPS_2030 high              0
#>  2 antimonarchy_canine ipr_1.5C RPS_2030 medium            1
#>  3 antimonarchy_canine ipr_1.5C RPS_2030 low               0
#>  4 antimonarchy_canine ipr_1.5C RPS_2030 NA                0
#>  5 antimonarchy_canine ipr_1.5C RPS_2050 high              1
#>  6 antimonarchy_canine ipr_1.5C RPS_2050 medium            0
#>  7 antimonarchy_canine ipr_1.5C RPS_2050 low               0
#>  8 antimonarchy_canine ipr_1.5C RPS_2050 NA                0
#>  9 antimonarchy_canine weo_NZ 2050_2030  high              1
#> 10 antimonarchy_canine weo_NZ 2050_2030  medium            0
#> # ℹ 1,142 more rows