Relates to 2DegreesInvesting/tiltIndicatorAfter#161
Dear @maurolepore
This PR adds a new column profile_ranking_avg at the company level in emission_profile, emissions_profile_upstream,
sector_profile, and sector_profile_upstream indictors. The average column is the mean of profile_ranking values after grouping the rows based on columns companies_id and group_by. You can look at a small example using this reprex:
library(readr)
library(dplyr)
devtools::load_all(".")
#> ℹ Loading tiltIndicator
options(width = 500)
local_options(readr.show_col_types = FALSE)
companies <- read_csv(toy_emissions_profile_any_companies()) |>
filter(companies_id %in% c("nonphilosophical_llama"))
products <- read_csv(toy_emissions_profile_products_ecoinvent())
product <- emissions_profile_any_at_product_level(companies, products) |>
filter(grouped_by == "all")
product
#> # A tibble: 2 × 7
#> companies_id grouped_by risk_category profile_ranking clustered activity_uuid_product_uuid co2_footprint
#> <chr> <chr> <chr> <dbl> <chr> <chr> <dbl>
#> 1 nonphilosophical_llama all low 0.32 surface finishing, galvanic 833caa78-30df-4374-900f-7f88ab44075b 0.693
#> 2 nonphilosophical_llama all low 0.34 surface engineering 833caa78-30df-4374-900f-7f88ab44075b 0.693
company <- any_at_company_level(product)
company
#> # A tibble: 3 × 5
#> companies_id grouped_by risk_category value profile_ranking_avg
#> <chr> <chr> <chr> <dbl> <dbl>
#> 1 nonphilosophical_llama all high 0 0.33
#> 2 nonphilosophical_llama all medium 0 0.33
#> 3 nonphilosophical_llama all low 1 0.33
Please do not get misled by the 0.33 values in risk category high and medium. As you can see that the low risk category will have the average value of 0.33 from values 0.32 and 0.34.
Relates to 2DegreesInvesting/tiltIndicatorAfter#161
Dear @maurolepore
This PR adds a new column
profile_ranking_avg
at the company level in emission_profile, emissions_profile_upstream, sector_profile, and sector_profile_upstream indictors. The average column is the mean ofprofile_ranking
values after grouping the rows based on columnscompanies_id
andgroup_by
. You can look at a small example using this reprex:Created on 2024-02-16 with reprex v2.0.2
Please do not get misled by the
0.33
values in risk categoryhigh
andmedium
. As you can see that thelow
risk category will have the average value of0.33
from values0.32
and0.34
.TODO
EXCEPTIONS