Closed
Description
Trying to plot point data with geom_sf()
that has a mapping to a variable that contains NAs creates an error. This occurs both in the CRAN 3.2.1 and development versions.
library(ggplot2)
packageVersion("ggplot2")
#> [1] '3.2.1.9000'
# From geom_sf() examples in docs
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
nc_3857 <- sf::st_transform(nc, "+init=epsg:3857")
nc_3857$mid <- sf::st_centroid(nc_3857$geometry)
ggplot(nc_3857) +
geom_sf(aes(geometry = mid, size = AREA))
nc_3857$AREA[10] <- NA
ggplot(nc_3857) +
geom_sf(aes(geometry = mid, size = AREA))
#> Error in checkNA("fontsize"): mixture of missing and non-missing values for fontsize
sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> 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_New Zealand.1252
#> [2] LC_CTYPE=English_New Zealand.1252
#> [3] LC_MONETARY=English_New Zealand.1252
#> [4] LC_NUMERIC=C
#> [5] LC_TIME=English_New Zealand.1252
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] ggplot2_3.2.1.9000
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.2 pillar_1.4.2 compiler_3.6.1
#> [4] highr_0.8 class_7.3-15 tools_3.6.1
#> [7] digest_0.6.20 evaluate_0.14 tibble_2.1.3
#> [10] gtable_0.3.0 pkgconfig_2.0.2 rlang_0.4.0
#> [13] DBI_1.0.0 yaml_2.2.0 xfun_0.8
#> [16] e1071_1.7-2 withr_2.1.2 dplyr_0.8.3
#> [19] stringr_1.4.0 knitr_1.23 classInt_0.4-1
#> [22] grid_3.6.1 tidyselect_0.2.5 glue_1.3.1
#> [25] sf_0.7-7 R6_2.4.0 rmarkdown_1.14
#> [28] purrr_0.3.2 magrittr_1.5 units_0.6-3
#> [31] scales_1.0.0 htmltools_0.3.6 assertthat_0.2.1
#> [34] colorspace_1.4-1 labeling_0.3 KernSmooth_2.23-15
#> [37] stringi_1.4.3 lazyeval_0.2.2 munsell_0.5.0
#> [40] crayon_1.3.4
Created on 2019-08-13 by the reprex package (v0.3.0)
Metadata
Metadata
Assignees
Labels
No labels