Comments (8)
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
from rnaturalearth.
It's still an issue, both , bdownloading rnaturalearth
from CRAN or from the github repository.
from rnaturalearth.
Can you provide your sessionInfo()
?
Also what does the non-filtered eu_sf
return?
from rnaturalearth.
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
from rnaturalearth.
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()
.
from rnaturalearth.
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.
from rnaturalearth.
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
from rnaturalearth.
Seems to be working properly in the current version of the package. Please feel free to reopen if you still experience issues.
from rnaturalearth.
Related Issues (20)
- Release rnaturalearth 1.0.0
- Wrong link in About HOT 1
- Pre-compute vignettes so it does no error on CRAN if resource is not available
- Package suggested but not available for checking: ‘rnaturalearthhires’
- Update package version for rnaturalearthdata and rnaturalearthhires to 1.0.0
- Unexpected behavior of medium size country polygon download / while small & large resolution work as advertised HOT 4
- ne_countries message:maptools, rgdal, and rgeos, underpinning this package will retire shortly message HOT 4
- United States missing using geostationary satellite view projection only HOT 5
- pkgdown
- Deprecate `sp`
- Add support for `vect` of the `terra` package
- Use `pkgdown`
- Function helpers to provide users with available downloadable files
- Change to `sf`/`spatvector` in `rnaturalearthhires` and `rnaturalearthhires`
- sf MULTIPOLYGONs not mergeable across countries HOT 6
- Chatham Islands with New Zealand HOT 4
- `ne_download()` fails to read raster objects HOT 2
- `ne_download()` should not warn about `sp` for raster objects or if `load = FALSE` HOT 1
- `ne_download()` doens't return filename HOT 5
- Invalid geometry world: Loop 0 is not valid HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rnaturalearth.