state_choropleth绘制多州地图报错问题求助
使用choroplethr绘制美国州级填充地图时的逻辑长度错误问题
问题重现
尝试使用choroplethr包绘制基础美国州级填充地图,执行代码:
library(choroplethr) library(choroplethrMaps) state_choropleth(df_pop_state)
程序退出并抛出错误:
Error in private$zoom == "alaska" || private$zoom == "hawaii" : 'length = 51' in coercion to 'logical(1)'
异常对比
- 该错误与同类案例表现相似,但案例中地图仍可生成
- 仅指定单个州放大时程序可正常运行,示例代码:
state_choropleth(df_pop_state, zoom=c("washington"))
排查情况
- 已确认所有相关包均为最新版本
- 怀疑问题与数月前将R版本从3.x升级到4.x有关
会话信息
R version 4.3.1 (2023-06-16) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Monterey 12.4 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0 locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 time zone: Europe/Rome tzcode source: internal attached base packages: [1] datasets utils stats graphics grDevices methods base other attached packages: [1] dplyr_1.1.2 zoo_1.8-12 viridis_0.6.3 viridisLite_0.4.2 [5] scales_1.2.1 readr_2.1.4 RColorBrewer_1.1-3 plyr_1.8.8 [9] plotrix_3.8-2 PBSmapping_2.73.2 maptools_1.1-7 sp_2.0-0 [13] lubridate_1.9.2 jsonlite_1.8.5 ggmap_3.0.2 ggplot2_3.4.2 [17] devtools_2.4.5 usethis_2.2.1 deldir_1.0-9 clipr_0.8.0 [21] choroplethrZip_1.5.0 choroplethrMaps_1.0.1 choroplethr_3.7.1 acs_2.1.4 [25] XML_3.99-0.14 stringr_1.5.0 car_3.1-2 carData_3.0-5 [29] calibrate_1.7.7 MASS_7.3-60 alphahull_2.5 datapasta_3.1.1 loaded via a namespace (and not attached): [1] rstudioapi_0.14 magrittr_2.0.3 spatstat.utils_3.0-3 rmarkdown_2.22 [5] fs_1.6.2 vctrs_0.6.3 memoise_2.0.1 base64enc_0.1-3 [9] htmltools_0.5.5 Formula_1.2-5 KernSmooth_2.23-21 htmlwidgets_1.6.2 [13] cachem_1.0.8 uuid_1.1-0 mime_0.12 lifecycle_1.0.3 [17] pkgconfig_2.0.3 Matrix_1.5-4.1 R6_2.5.1 fastmap_1.1.1 [21] tidycensus_1.4.1 shiny_1.7.4 digest_0.6.31 colorspace_2.1-0 [25] ps_1.7.5 pkgload_1.3.2 Hmisc_5.1-0 fansi_1.0.4 [29] timechange_0.2.0 httr_1.4.6 polyclip_1.10-4 abind_1.4-5 [33] compiler_4.3.1 proxy_0.4-27 splancs_2.01-43 remotes_2.4.2 [37] withr_2.5.0 htmlTable_2.4.1 backports_1.4.1 DBI_1.1.3 [41] RgoogleMaps_1.4.5.3 pkgbuild_1.4.1 R.utils_2.12.2 rappdirs_0.3.3 [45] sessioninfo_1.2.2 classInt_0.4-9 tools_4.3.1 units_0.8-2 [49] foreign_0.8-84 httpuv_1.6.11 nnet_7.3-19 R.oo_1.25.0 [53] glue_1.6.2 callr_3.7.3 promises_1.2.0.1 grid_4.3.1 [57] sf_1.0-13 checkmate_2.2.0 cluster_2.1.4 generics_0.1.3 [61] gtable_0.3.3 spatstat.data_3.0-1 tzdb_0.4.0 R.methodsS3_1.8.2 [65] class_7.3-22 tidyr_1.3.0 data.table_1.14.8 hms_1.1.3 [69] xml2_1.3.4 utf8_1.2.3 spatstat.geom_3.2-1 pillar_1.9.0 [73] later_1.3.1 lattice_0.21-8 tidyselect_1.2.0 miniUI_0.1.1.1 [77] knitr_1.43 gridExtra_2.3 xfun_0.39 stringi_1.7.12 [81] evaluate_0.21 interp_1.1-4 sgeostat_1.0-27 tibble_3.2.1 [85] cli_3.6.1 rpart_4.1.19 xtable_1.8-4 munsell_0.5.0 [89] processx_3.8.1 Rcpp_1.0.10 spatstat.random_3.1-5 WDI_2.7.8 [93] png_0.1-8 ellipsis_0.3.2 prettyunits_1.1.1 jpeg_0.1-10 [97] profvis_0.3.8 urlchecker_1.0.1 bitops_1.0-7 tigris_2.0.3 [101] e1071_1.7-13 purrr_1.0.1 crayon_1.5.2 rlang_1.1.1 [105] rvest_1.0.3
内容的提问来源于stack exchange,提问作者Eponymous
相关产品推荐
相关产品推荐

