You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to handle containment and country groupings more effectively, e.g. when moving from countries to regions:
passport::as_country_name(c('FR', 'DE', 'SG'), 'continent')
#> Multiple unique values aggregated to single output#> [1] "EU" "EU" "AS"passport::as_country_name(c('FR', 'DE', 'SE', 'SG'), 'en_un_subregion')
#> Multiple unique values aggregated to single output#> [1] "Western Europe" "Western Europe" "Northern Europe" #> [4] "South-eastern Asia"
Issues with current implementation:
Regions are obviously not countries.
Changes are not reversible, as indicated by the message.
Apart from introducing NAs, reversibility should a goal for the conversion functions.
For group membership (EU, UN, G20, etc.) it would be nice to have vectors for filtering and generating logical columns
Some of these are already in countries (above, UN SIDS, UN development status, etc.) and CLDR has some data, though there are certainly more country groups that should be added.
Use cases:
Converting to a superset, maybe with new function as_region
Are all groupings regions?
"Region" has a lot of definitions, so this name may clash with other packages
Is as_ the right prefix? It's conversion, yes, but levels are being aggregated.
Adding a logical column for whether a country is in a group
Could have its own function, but if groups are exposed as vectors (via an accessor?), users can just use %in%
Filtering to countries in a group, e.g. the OECD countries
Requires groups be exposed and in same format as existing country data
Addressing 2 and 3 requires group vectors, but does it make more sense to
make an accessor function that returns a vector of the specified group converted to the specified format, or
add a bunch of iso2c vectors of groups as package data which can be converted with existing conversion functions, or
both?
To codify, the TODO:
Reproducibly generate vectors of country groupings (necessary even if they're not exported)
Aggregate group vectors into internal data structure?
Make group accessor and/or document group data exposed
Separate regions from existing data; deduplicate new data (alts are irrelevant)
Write as_region (or whatever it ends up going by)
The text was updated successfully, but these errors were encountered:
It would be useful to handle containment and country groupings more effectively, e.g. when moving from countries to regions:
Issues with current implementation:
NA
s, reversibility should a goal for the conversion functions.Some of these are already in
countries
(above, UN SIDS, UN development status, etc.) and CLDR has some data, though there are certainly more country groups that should be added.Use cases:
as_region
as_
the right prefix? It's conversion, yes, but levels are being aggregated.%in%
Addressing 2 and 3 requires group vectors, but does it make more sense to
To codify, the TODO:
as_region
(or whatever it ends up going by)The text was updated successfully, but these errors were encountered: