RMI-PACTA / pacta.data.preparation

The goal of {pacta.data.preparation} is to prepare and format all input datasets required to run the PACTA for investors tools.
https://rmi-pacta.github.io/pacta.data.preparation/
Other
1 stars 0 forks source link

squelch countrycode warnings when no currency is matched #28

Closed cjyetman closed 3 months ago

cjyetman commented 3 months ago

in particular, when the country code is PS and there's no matching currency code

countrycode::countrycode("PS", "iso2c", "iso4217c")
#> Warning: Some values were not matched unambiguously: PS
#> [1] NA
countrycode::countrycode("PS", "iso2c", "iso4217c", warn = FALSE)
#> [1] NA

⚠️ I'm not 100% sure it's appropriate to ignore all/any warning here

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 18.82%. Comparing base (a37a7d2) to head (f3be78a).

Files Patch % Lines
.../prepare_iss_average_sector_emission_intensities.R 0.00% 1 Missing :warning:
R/prepare_iss_entity_emission_intensities.R 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #28 +/- ## ======================================= Coverage 18.82% 18.82% ======================================= Files 35 35 Lines 1126 1126 ======================================= Hits 212 212 Misses 914 914 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cjyetman commented 3 months ago

I think maybe we should filter rows where a currency cannot be determined after this, but have to think about that when I'm not in a brain fog

cjyetman commented 3 months ago

putting in draft until I determine if it's necessary/appropriate to filter out rows that end up with currency code == NA after this

cjyetman commented 3 months ago

These are filters 🤣. I was thinking these are adding the currency based on the country code, but the currency is already there. This is making sure that we're only keeping rows where the currency matches the country (I think so we drop rows of data for foreign versions of the same thing?).

But anyway, I don't think there's much risk with this. {countrycode} may throw warnings if

  1. the country code is not known/invalid
  2. there is no known currency code for the given country (this is the PS case)

but either of those warnings are not very important, because those rows where the country/currency pair cannot be verified/validated will be filtered out, which is what we want.

It's a bit of a shame that we therefore cannot verify any PS rows because PS does not have an official currency recognized in iso4217c, but these warnings will not help get around that.

opening for review