Description Usage Arguments Value Examples
Creates a data.frame of species' references that contains longitude, latitude, and species name, from a character.
1 |
path |
(character) full path name of directory containing raster, shapefiles, geopackage, or GeoJSON files representing species geographic ranges. Each file must be named as the species that it represents. All files must be in the same format. If files are raster, values in each layer must be 1 (presence) and 0 (absence). |
format |
(character) the format files found in |
spdf_grid |
geographic grid for the region of interest (output of
function |
parallel |
(logical) whether to perform analyses in parallel. Default = FALSE. |
n_cores |
(numeric) number of cores to be used when |
If files are in raster format, a data.frame of species geographic records derived from values of presence in each layer.
If files are not in raster format, a data.frame of species' found in distinct positions (defined with identifiers); includes two columns: "ID" and "Species".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Data for examples
data("mx", package = "biosurvey")
data("species_data", package = "biosurvey")
# Saving species data in a temporal directory
tdir <- file.path(tempdir(), "testbio")
dir.create(tdir)
namessp <- paste0("species_", 1:length(species_data))
for (i in 1:length(species_data)) {
rgdal::writeOGR(species_data[i, ], dsn = tdir, layer = namessp[i],
driver = "ESRI Shapefile")
}
# Preparing grid for analysis
grid_reg <- grid_from_region(region = mx, cell_size = 100)
# Running analysis with data from directory
sp_data <- files_2data(path = tdir, format = "shp", spdf_grid = grid_reg)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.