Learn R Programming

monographaR (version 1.0)

mapDiversity: Diversity heatmap

Description

This function will generate a diversity heatmap using presence/absence of species on grid cells.

Usage

mapDiversity(data, resolution = 1, plot = T, plot.with.grid = T, 
export = F, legend = T, filename = "diversity_map")

Arguments

data
data.frame
resolution
numeric, size of the grid cells (degrees)
plot
logical
plot.with.grid
logical, whether or not to add a grid to the plot
export
logical
legend
logical
filename
character

Value

  • A raster object.

Details

It requires a data.frame with three columns, ordered as: species, longitude and latitude. The function will plot and return a raster object. The resolution of the grid can be changed by the argument "resolution" (in degrees). It uses functions of the package raster.

See Also

raster

Examples

Run this code
## loading the example data

data(monographaR_examples)
monographaR_examples$map_data -> data
head(data)

## running the function

mapDiversity(data , resolution=1, plot=TRUE, plot.with.grid=TRUE)

Run the code above in your browser using DataLab