vincentarelbundock / countrycode

R package: Convert country names and country codes. Assigns region descriptors.
https://vincentarelbundock.github.io/countrycode
GNU General Public License v3.0
342 stars 84 forks source link

Distribute custom dictionaries with the package? #315

Closed vincentarelbundock closed 1 year ago

vincentarelbundock commented 1 year ago

A lot of packages distribute data.

Would it make sense for us to distribute a few small custom dictionaries to make people's life easier. For example, it would be nice to distribute the usstates dictionary so that users could do:

library(countrycode)
countrycode("Alabama", "state", "stateabb", custom_dict = usstates)

The main downside is download size.

What do you think?

cjyetman commented 1 year ago

I back that. The compressed codelist.rda file is only 242 KB with 288 rows × 621 columns, and presumably most of these custom dictionaries would be much, much smaller.

vincentarelbundock commented 1 year ago

The upcoming CRAN release has a new get_dictionary() function. See: https://vincentarelbundock.github.io/countrycode/#custom-dictionaries-and-cross-walks-get_dictionary-and-custom_dict