worldbank / wbgviz

Several R packages for World Bank-standard visualisations, building on ggplot2
MIT License
30 stars 12 forks source link

wbgdata does not load, 'cannot subset columns that don't exist' #38

Open ellisp opened 1 year ago

ellisp commented 1 year ago

With R 4.2.2 on 28 February 2023, I see:

Error: package or namespace load failed for 'wbgdata':
 .onLoad failed in loadNamespace() for 'wbgdata', details:
  call: select(., iso3c, region_iso3c = regionID)
  error: Can't subset columns that don't exist.
✖ Column `regionID` doesn't exist.
Error: loading failed
ellisp commented 1 year ago

so the particular problem can be fixed by changing the function refresh_wbcache() so it uses wb_cache() instead of hte deprecated wbcache(), and then also changing these select operations:

    regions = countries_df %>% select(iso3c, region_iso3c = regionID),
    incomegroups = countries_df %>% select(iso3c, income_iso3c = incomeID)

to this:

    regions = countries_df %>% select(iso3c, region_iso3c),
    incomegroups = countries_df %>% select(iso3c, income_iso3c = income_level_iso3c)

but things still don't work, because of the use of deprecated wb from wbstats. I started troubleshooting but it's a real can of worms and made me wonder, is this package just not worth trying to fix, now that wbstats seems to have evolved (and to work)?