rchoroplethr

choroplethrZip returning "cannot add bindings" subtitle error - even with example code


choroplethrZip is returning a "cannot add bindings" error even when I use example code like the following:

library(choroplethrZip)
data(df_pop_zip)
zip_choropleth(df_pop_zip, 
               state_zoom = "new york", 
               title      = "2012 New York State ZCTA Population Estimates", 
               legend     = "Population")

Error in c$subtitle = subtitle : cannot add bindings to a locked environment

sessionInfo()

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] choroplethrZip_1.5.0

loaded via a namespace (and not attached):
 [1] httr_1.3.1          maps_3.3.0          splines_3.5.1       Formula_1.2-3       assertthat_0.2.0    sp_1.3-1            latticeExtra_0.6-28
 [8] yaml_2.1.19         pillar_1.3.0        backports_1.1.2     lattice_0.20-35     glue_1.3.0          uuid_0.1-2          digest_0.6.15      
[15] RColorBrewer_1.1-2  checkmate_1.8.5     colorspace_1.3-2    htmltools_0.3.6     Matrix_1.2-14       plyr_1.8.4          XML_3.98-1.12      
[22] pkgconfig_2.0.1     WDI_2.5             purrr_0.2.5         scales_0.5.0        jpeg_0.1-8          tigris_0.7          ggmap_2.6.1        
[29] htmlTable_1.12      tibble_1.4.2        ggplot2_3.0.0       nnet_7.3-12         lazyeval_0.2.1      proto_1.0.0         survival_2.42-6    
[36] RJSONIO_1.3-0       magrittr_1.5        crayon_1.3.4        maptools_0.9-2      acs_2.1.3           foreign_0.8-71      class_7.3-14       
[43] tools_3.5.1         data.table_1.11.4   geosphere_1.5-7     RgoogleMaps_1.4.2   stringr_1.3.1       munsell_0.5.0       cluster_2.0.7-1    
[50] bindrcpp_0.2.2      compiler_3.5.1      e1071_1.6-8         rlang_0.2.1         classInt_0.2-3      units_0.6-0         grid_3.5.1         
[57] rstudioapi_0.7      rjson_0.2.20        rappdirs_0.3.1      htmlwidgets_1.2     base64enc_0.1-3     gtable_0.2.0        DBI_1.0.0          
[64] reshape2_1.4.3      R6_2.2.2            gridExtra_2.3       knitr_1.20          dplyr_0.7.6         rgdal_1.3-3         bindr_0.1.1        
[71] choroplethr_3.6.2   Hmisc_4.1-1         stringi_1.1.7       Rcpp_0.12.18        mapproj_1.2.6       sf_0.6-3            rpart_4.1-13       
[78] acepack_1.4.1       png_0.1-7           spData_0.2.9.0      tidyselect_0.2.4   

Solution

  • The new ggplot version (3.0.0) necessitates an edit to the choroplethrZip package's zip_choropleth.R, as package author Ari Lamstein described for the choroplehtr package at https://arilamstein.com/blog/2018/06/27/choroplethr-v3-6-2-is-now-on-cran/:

    Add a comma after the last function (render_helper) in zip_choropleth.R and then insert this code:

    theme_clean = function()
    {
      ggplot2::theme_void()
    },
    
    theme_inset = function()
    {
      ggplot2::theme_void() %+replace%
        ggplot2::theme(legend.position = "none")
    }
    

    You will need a local version of the package, which you can download from https://github.com/arilamstein/choroplethrZip. Edit zip_choropleth.R and then locally install the code with the devtools package a la:

    devtools::install_local('C:/Users/RickPack/Downloads/choroplethrZip-master')