The IUCN Spatial Data is a large collection of shape files, and this package provides efficient ways to read and process them. It may take a while to run them for the first time, but subsequent runs will be very quick because the results are cached.
iucn_spatial_features()
reads the IUCN shape files and drops the geometry column.
This is useful for quick skimming of the whole dataset.
Set habistats.iucn_source
option to specify the path to the directory
containing IUCN shape files, and use iucn_source_path()
to check it.
Value
iucn_spatial_features()
returns a data.frame with the feature columns.
iucn_source_path()
returns a path read from the option.
Examples
if (FALSE) { # \dontrun{
options(habistats.iucn_source = "path/to/your/data")
habistats::iucn_source_path()
} # }
old = options(habistats.cache_dir = "~/.cache/habistats-example")
habistats::cache_dir()
#> ~/.cache/habistats-example
habistats::iucn_spatial_features()
#> # A tibble: 5 × 28
#> id_no sci_name presence origin seasonal compiler yrcompiled citation
#> <int> <chr> <int> <int> <int> <chr> <int> <chr>
#> 1 19990904 Strato arctica 1 1 1 NWOBHM 2025 habistats
#> 2 20010425 Diva satanica 1 1 1 NWOBHM 2025 habistats
#> 3 20010425 Diva satanica 1 1 1 NWOBHM 2025 habistats
#> 4 19851118 Kai kiske 1 1 1 NWOBHM 2025 habistats
#> 5 19710604 Elp tarkus 5 1 1 NWOBHM 2025 habistats
#> # ℹ 20 more variables: subspecies <chr>, subpop <chr>, source <lgl>,
#> # island <chr>, tax_comm <chr>, dist_comm <chr>, generalisd <int>,
#> # legend <chr>, kingdom <chr>, phylum <chr>, class <chr>, order_ <chr>,
#> # family <chr>, genus <chr>, category <chr>, marine <lgl>, terrestria <lgl>,
#> # freshwater <lgl>, SHAPE_Leng <dbl>, SHAPE_Area <dbl>
options(old) # reset for this example, not needed in real use