Skip to content

profile_sector() fails to handle case "c" #279

@Tilmon

Description

@Tilmon

The following expectation is met for tiltIndicator::sector_profile() but not for tiltIndicatorAfter::profile_sector() (reprex):

  • Given a company with products from "ipr" exclusively,
  • when the scenarios dataset also includes data from "weo",
  • then the output at product level should also include rows where scenario comes from "weo" and sector_profile is NA.

(Original)

Dear @maurolepore,

in the output you created for Bundesbank, I realized that NAs are not preserved for sector_profile() on product-level as they should, acc. to this reprex.

Specifically, I'm referring to cases similar to the clustered "c" in the reprex - a product in the Land Use sector which hence only has results for IPR scenarios, not for WEO scenarios. Acc. to the reprex, this should lead on product-level to the risk_category == NA for grouped_by == WEO (see screenshot below)

Image

However, this is not how the data behave in the output you shared: I identified a company that only has products in land use sector. While on company-level, the NAs for WEO are shown, on product-level, the output only shows the IPR scenario.

Please bare with me... I wanted to share a reprex... But I get errors. I will try to solve the erros, but given the end is coming to an end, I'll just copy in my code here.

The input data I load are from the latest Release v0.0.0.9003. The code just shows the output for the sample company. You'll see that the grouped_by == WEO is missing on product-level.

# Load packages
library(dplyr)
library(here)
library(readr)

# Data
sec_prod <- read_csv(here("Bundesbank_data_2024-06-27/sector_profile_at_product_level.csv"))

sec_comp <- read_csv(here("Bundesbank_data_2024-06-27/sector_profile_at_company_level.csv"))

# Example 1: of company only producing land use-related goods. 
# What you'll see is that on company-level, NA category is shown for WEO scenario because it doesn't cover land use. 
# But this is not shown on product-level. On product-level, only scenario == IPR is shown.

ex1_sec_prod <- sec_prod |> 
  filter(companies_id == "-fred-sl_00000005407085-741049001")

ex1_sec_comp <- sec_comp |> 
  filter(companies_id == "-fred-sl_00000005407085-741049001")

print(ex1_sec_prod)
print(ex1_sec_comp)

`

cc' @AnneSchoenauer @kalashsinghal

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions