Generate maps of observed species richness and species presences by station

Share:

Description

Generates maps of observed species richness and species presence by species and station. Output can be R graphics, PNG graphics or a shapefile for use in GIS software.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
detectionMaps(CTtable, 
  recordTable, 
  Xcol, 
  Ycol, 
  stationCol = "Station", 
  speciesCol = "Species", 
  speciesToShow,
  richnessPlot = TRUE, 
  speciesPlots = TRUE,
  addLegend = TRUE,
  printLabels = FALSE, 
  smallPoints,
  plotR = TRUE, 
  writePNG = FALSE, 
  plotDirectory, 
  createPlotDir = FALSE,       
  pngMaxPix = 1000,
  writeShapefile = FALSE,
  shapefileName,
  shapefileDirectory,
  shapefileProjection
)

Arguments

CTtable

data.frame. contains station IDs and coordinates

Xcol

character. name of the column specifying x coordinates in CTtable

Ycol

character. name of the column specifying y coordinates in CTtable

stationCol

character. name of the column specifying station ID in CTtable and recordTable

recordTable

data.frame. the record table created by recordTable

speciesCol

character. name of the column specifying species in recordTable

speciesToShow

character. Species to include in the maps. If missing, all species in recordTable will be included.

writePNG

logical. Create PNGs of the plots?

plotR

logical. Create plots in R graphics device?

plotDirectory

character. Directory in which to save the PNGs

createPlotDir

logical. Create plotDirectory?

richnessPlot

logical. Generate a species richness plot?

speciesPlots

logical. Generate plots of all species number of independent events?

printLabels

logical. Add station labels to the plots?

smallPoints

numeric. Number by which to decrease point sizes in plots (optional).

addLegend

logical. Add legends to the plots?

pngMaxPix

integer. number of pixels in pngs on the longer side

writeShapefile

logical. Create a shapefile from the output?

shapefileName

character. Name of the shapefile to be saved. If empty, a name will be generated automatically.

shapefileDirectory

character. Directory in which to save the shapefile.

shapefileProjection

character. A character string of projection arguments to use in the shapefile.

Details

The column name stationCol must be identical in CTtable and recordTable and station IDs must match.

Shapefile creation depends on the packages sp and rgdal. shapefileProjection must be a valid argument of CRS. If shapefileProjection is undefined, the resulting shapefile will lack a coordinate reference system.

Value

An invisible data.frame with station coordinates, numbers of events by species at each station and total species number by station. In addition and optionally, R graphics or png image files.

Author(s)

Juergen Niedballa

References

A great resource for CRS arguments is http://spatialreference.org/. Use the Proj4 string as shapefileProjection argument.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# load station information
data(camtraps)

# load record table
data(recordTableSample)

# create maps
Mapstest <- detectionMaps(CTtable      = camtraps,
                          recordTable  = recordTableSample,
                          Xcol         = "utm_x",
                          Ycol         = "utm_y",
                          stationCol   = "Station",
                          speciesCol   = "Species",
                          writePNG     = FALSE,
                          plotR        = TRUE,
                          printLabels  = TRUE,
                          richnessPlot = TRUE,
                          addLegend    = TRUE
)

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