Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/lets_presab_birds.R
Convert species' ranges (in shapefile format and stored in particular folders) into a presence-absence matrix based on a user-defined grid. This function is specially designed to work with BirdLife Intl. shapefiles (http://www.birdlife.org).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
path |
Path location of folders with one or more species' individual shapefiles.
Shapefiles with more than one species will not work on this function. To use multi-species shapefiles see
|
xmn |
Minimun longitude used to construct the grid in which the matrix will be based (i.e. the [gridded] geographic domain of interest). |
xmx |
Maximun longitude used to construct the grid in which the matrix will be based (i.e. the [gridded] geographic domain of interest). |
ymn |
Minimun latitude used to construct the grid in which the matrix will be based (i.e. the [gridded] geographic domain of interest) |
ymx |
Maximun latitude used to construct the grid in which the matrix will be based (i.e. the [gridded] geographic domain of interest). |
resol |
Numeric vector of length 1 or 2 to set the grid resolution. |
remove.cells |
Logical, if |
remove.sp |
Logical, if |
show.matrix |
Logical, if |
crs |
Character representign the PROJ.4 type description of a Coordinate Reference System (map projection) of the original polygons. |
crs.grid |
Character representign the PROJ.4 type description of a Coordinate Reference System (map projection) for the grid. Note that when you change this options you may probably change the extent coordinates and the resolution. |
cover |
Porcentage of the cell covered by the shapefile that will be considered for presence (values between 0 and 1). |
presence |
A vector with the code numbers for the presence type to be considered in the process (for IUCN spatial data https://www.iucnredlist.org/resources/spatial-data-download, see metadata). |
origin |
A vector with the code numbers for the origin type to be considered in the process (for IUCN spatial data). |
seasonal |
A vector with the code numbers for the seasonal type to be considered in the process (for IUCN spatial data). |
count |
Logical, if |
The function creates the presence-absence matrix based on a raster file.
Depending on the cell size, extension used and number of species it may require a
lot of memory, and may take some time to process it. Thus, during the process, if
count
argument is set TRUE
, a counting window will open so you can
see the progress (i.e. in what polygon the function is working).
Note that the number of polygons is not the same as the number of species that
you have (i.e. a species may have more than one polygon/shapefiles).
The result is an object of class PresenceAbsence
with the following objects:
Presence-Absence Matrix: A matrix of species' presence(1) and absence(0) information. The first two columns contain the longitude (x) and latitude (y) of the cells' centroid (from the gridded domain used);
Richness Raster: A raster containing species richness data;
Species name: A vector with species' names contained in the matrix.
*But see the optional argument show.matrix
.
Bruno Vilela & Fabricio Villalobos
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
# Constructing a Presence/Absence matrix for birds
# Attention: For your own files, omit the 'system.file'
# and 'package="letsR"', these are just to get the path
# to files installed with the package.
path.Ramphastos <- system.file("extdata", package = "letsR")
PAM <- lets.presab.birds(path.Ramphastos, xmn = -93, xmx = -29,
ymn = -57, ymx = 25)
# Species richness map
plot(PAM, xlab = "Longitude", ylab = "Latitude",
main = "Ramphastos species Richness")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.