rnaturalearth icon indicating copy to clipboard operation
rnaturalearth copied to clipboard

France is missing

Open matteodefelice opened this issue 5 years ago • 7 comments

This happens both with the CRAN and the devtools versions of this package.

eu_sf <- ne_countries(scale = 50, returnclass = 'sf')
eu_sf %>% dplyr::filter(iso_a2 == 'FR') %>% nrow()
[1] 0

Is the same with iso_a3 or other fields. France is missing. It is instead present when the scale is 110.

matteodefelice avatar Oct 31 '19 10:10 matteodefelice

I was wondering if this is still an issue? It is working for me.

 eu_sf <- ne_countries(scale = 50, returnclass = 'sf')
 eu_sf %>% 
   dplyr::filter(iso_a2 == 'FR') %>% 
   nrow()
[1] 1

mps9506 avatar Mar 30 '20 13:03 mps9506

It's still an issue, both , bdownloading rnaturalearth from CRAN or from the github repository.

matteodefelice avatar Mar 30 '20 14:03 matteodefelice

Can you provide your sessionInfo()?

Also what does the non-filtered eu_sf return?

mps9506 avatar Mar 30 '20 18:03 mps9506

eu_sf is this (showing only the first lines of output)

> head(eu_sf)
Simple feature collection with 6 features and 94 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: -73.36621 ymin: -22.40205 xmax: 109.4449 ymax: 41.9062
epsg (SRID):    4326
proj4string:    +proj=longlat +datum=WGS84 +no_defs
       featurecla scalerank labelrank sovereignt sov_a3 adm0_dif level
0 Admin-0 country         1         3   Zimbabwe    ZWE        0     2
1 Admin-0 country         1         3     Zambia    ZMB        0     2
2 Admin-0 country         1         3      Yemen    YEM        0     2
3 Admin-0 country         3         2    Vietnam    VNM        0     2
4 Admin-0 country         5         3  Venezuela    VEN        0     2
5 Admin-0 country         6         6    Vatican    VAT        0     2

This is my sessionInfo:

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] rnaturalearth_0.2.0 sf_0.8-1           

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4              rstudioapi_0.11        
 [3] magrittr_1.5            units_0.6-6            
 [5] tidyselect_1.0.0        lattice_0.20-40        
 [7] R6_2.4.1                rlang_0.4.5            
 [9] rnaturalearthdata_0.2.0 httr_1.4.1             
[11] dplyr_0.8.5             tools_3.6.3            
[13] grid_3.6.3              packrat_0.5.0          
[15] KernSmooth_2.23-16      e1071_1.7-3            
[17] DBI_1.1.0               rgeos_0.5-2            
[19] class_7.3-16            assertthat_0.2.1       
[21] tibble_2.1.3            crayon_1.3.4           
[23] purrr_0.3.3             glue_1.3.2             
[25] sp_1.4-1                compiler_3.6.3         
[27] pillar_1.4.3            classInt_0.4-2         
[29] jsonlite_1.6.1          pkgconfig_2.0.3   

matteodefelice avatar Mar 31 '20 07:03 matteodefelice

For some reason I end up with a different simple feature. The order and number of variables that my eu_sf ends up different. It might be worth trying to update the rnaturalearthdata package. I don't know if that will fix it though.

So I used the ne_download function and ended up with (I think) the same data you have (note that the variable names are capitalized here):

eu_sf <- ne_download(scale = 50, type = "admin_0_countries", returnclass = "sf") 

eu_sf %>%
  dplyr::filter(ISO_A2 == 'FR') %>% 
  nrow()

However, when I explored the eu_sf object more, there is a row for France, but the ISO_A2 field is NA. So the following seems to work:

eu_sf %>%
  dplyr::filter(FIPS_10_ == 'FR') %>% 
  nrow()

[1] 1

Would be good to troubleshoot how we ended up with different simple features using ne_countries().

mps9506 avatar Mar 31 '20 18:03 mps9506

Thanks, using fips_10 works but of course is not the same, I want to use ISO codes. It is curious that ne_download and ne_countries return different things.

matteodefelice avatar Apr 01 '20 06:04 matteodefelice

Understandable. I dug around some more. It looks like the missing ISO codes are a tracked issue over in the Natural Earth repo: https://github.com/nvkelso/natural-earth-vector/issues/284#issue-425441544

mps9506 avatar Apr 01 '20 12:04 mps9506