Create a presence-absence matrix of species' geographic ranges within a user's grid shapefile (beta version)

Description

Convert species' ranges (in shapefile format) into a presence-absence matrix based on a grid in shapefile format.

Usage

1
2
lets.presab.grid(shapes, grid, sample.unit, remove.sp = TRUE,
  presence = NULL, origin = NULL, seasonal = NULL)

Arguments

shapes

Object of class SpatialPolygonsDataFrame (see function readShapePoly to open these files) containing the distribution of one or more species. Species names should be in a column (within the .DBF table of the shapefile) called BINOMIAL/binomial or SCINAME/sciname.

grid

Object of class shapefile representing the spatial grid (e.g. regular/irregular cells, political divisions, hexagonal grids, etc). The grid and the shapefiles must be in the same projection.

sample.unit

Object of class character with the name of the column (in the grid) representing the sample units of the presence absence matrix.

remove.sp

Logical, if TRUE the final matrix will not contain species that do not match any cell in the grid.

presence

A vector with the code numbers for the presence type to be considered in the process (for IUCN spatial data http://www.iucnredlist.org/technical-documents/spatial-data, 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).

Details

This function is an alternative way to create a presence absence matrix when users already have their own grid.

Value

The result is a list containing two objects:

(I) A matrix the species presence (1) and absence (0) values per sample unity.

(II) The original grid.

Author(s)

Bruno Vilela & Fabricio Villalobos

See Also

plot.PresenceAbsence

lets.presab.birds

lets.shFilter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
# Grid 
sp.r <- rasterToPolygons(raster(resol = 5))
slot(sp.r, "data") <- cbind("ID" = 1:length(sp.r),
                            slot(sp.r, "data"))
 
# Species polygons
data(Phyllomedusa)
projection(Phyllomedusa) <- projection(sp.r)

# PAM
resu <- lets.presab.grid(Phyllomedusa, sp.r, "ID")

# Plot
rich_plus1 <- rowSums(resu$PAM) + 1
colfunc <- colorRampPalette(c("#fff5f0", "#fb6a4a", "#67000d"))
colors <- c("white", colfunc(max(rich_plus1)))
plot(resu$grid, border = "gray40",
     col = colors[rich_plus1])
map(add = TRUE)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.