trulia / choroplethr

choroplethr simplifies the creation of choropleths (thematic maps) in R
Other
141 stars 53 forks source link

scales::comma change to cause example failure #52

Open dpseidel opened 6 years ago

dpseidel commented 6 years ago

The upcoming scales 1.0.0 release is introducing a generic number formatter to power the formatting functions like comma() which choroplethr imports. This generic formatter relies on round_any(), now exported from scales 1.0.0, which has no method for class character. Unfortunately our revdep checks show that our change will break an example in your package. It seems that the country_choroplethr() function in the below example is passing a character vector (some item for the guide/legend I think, perhaps specific to this data?) to scales::comma(). In the scales 0.5.0 this didn't fail because there is a character method for format() which comma() used to wrap, though I am unsure that it would have correctly added comma formatting to a character string as intended even then. Wanted to give you a heads up, we expect to release shortly.

library(choroplethr)
library(choroplethrMaps)

# demonstrate default options
data(df_pop_country)
country_choropleth(df_pop_country, "2012 World Bank Populate Estimates")
#> Warning in self$bind() :
#>  The following regions were missing and are being set to NA: namibia, western sahara, taiwan, antarctica, kosovo
#> Error in UseMethod("round_any") : 
#>  no applicable method for 'round_any' applied to an object of class "character"
#> Calls: <Anonymous> ... <Anonymous> -> f -> <Anonymous> -> f -> number -> round_any
#> Execution halted