Title: | Auxiliary Functions to Estimate Centers of Biodiversity |
---|---|
Description: | Provides some easy-to-use functions to interpolate species range based on species occurrences and to estimate centers of biodiversity. |
Authors: | Maximilian Lange, Sven Lautenbach, Claudia Raedig |
Maintainer: | Maximilian Lange <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.5-9 |
Built: | 2025-03-10 05:19:52 UTC |
Source: | https://github.com/cran/sperich |
This function adds an edge between two points to a grid.
add.Edges(grid,point.a, point.b)
add.Edges(grid,point.a, point.b)
grid |
A grid to which the edge should be added. |
point.a |
A point in a grid given by its row and column. |
point.b |
A point in a grid given by its row and column. |
This function adds an edge between two points to a grid.
The grid with new edge included.
Maximilian Lange, Sven Lautenbach
##initialize data m <- matrix(0,10,10) point.a <- c(5,8) point.b <- c(10,3) ##calculate the distance of the two points m <- add.Edges(m,point.a,point.b) image(m)
##initialize data m <- matrix(0,10,10) point.a <- c(5,8) point.b <- c(10,3) ##calculate the distance of the two points m <- add.Edges(m,point.a,point.b) image(m)
This routine adjusts the weighted species richness for sampling effort.
adjustment(species.richness, noninterpolatedgrid, clusterlist)
adjustment(species.richness, noninterpolatedgrid, clusterlist)
species.richness |
The grid that should be adjusted. It contains the result of species richness estimation or cross-validation. |
noninterpolatedgrid |
A grid containing the species occurrences (could be created via function 'createNonInterpolatedGrid'). |
clusterlist |
A list of vectors of pixelpositions (created by 'searchClusters') which are spatial related. |
This routine adjusts the interpolated species richness for sampling effort by incorporating an additional weighting factor. Therefor, it needs clusters of pixels of the result grid to find centers of species richness and to create these weighting factor.
This function returns a grid containing the adjusted species richness information.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=5, all.species=1:2) ##prepare adjustment noninterpolatedgrid <- createNonInterpolatedGrid(dataset.all.species, dimension, origin, resolution=1, all.species=-1) clusterlimit <- 100 clusterlist <- searchClusters(species.richness.weighted, dimension, origin, resolution=1, clusterlimit) ##adjust species richness species.richness.weighted.adjusted <- adjustment(species.richness.weighted, noninterpolatedgrid, clusterlist)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=5, all.species=1:2) ##prepare adjustment noninterpolatedgrid <- createNonInterpolatedGrid(dataset.all.species, dimension, origin, resolution=1, all.species=-1) clusterlimit <- 100 clusterlist <- searchClusters(species.richness.weighted, dimension, origin, resolution=1, clusterlimit) ##adjust species richness species.richness.weighted.adjusted <- adjustment(species.richness.weighted, noninterpolatedgrid, clusterlist)
This routine identifies disjunct patches within a distribution matrix.
cclFun(mat)
cclFun(mat)
mat |
Matrix with 0 as background value and positive values as occurrences to check patches for. |
This routine identifies disjunct patches of positive values within a matrix containing zeros as background values.
This function returns a matrix with zero as background value and positive values numbering and representing the disjunct patches.
Maximilian Lange
## example data tmat = { matrix(c( 0,0,0,1,0,0,1,1,0,1, 0,0,1,0,1,0,0,0,0,0, 0,1,NA,1,0,1,0,0,0,1, 1,0,1,1,1,0,1,0,0,1, 0,1,0,1,0,1,0,0,0,1, 0,0,1,0,1,0,0,1,1,0, 1,0,0,1,0,0,1,0,0,1, 0,1,0,0,0,1,0,0,0,1, 0,0,1,1,1,0,0,0,0,1, 1,1,1,0,0,0,0,0,0,1), nr=10,byrow=TRUE) } ccl.mat <- cclFun(tmat)
## example data tmat = { matrix(c( 0,0,0,1,0,0,1,1,0,1, 0,0,1,0,1,0,0,0,0,0, 0,1,NA,1,0,1,0,0,0,1, 1,0,1,1,1,0,1,0,0,1, 0,1,0,1,0,1,0,0,0,1, 0,0,1,0,1,0,0,1,1,0, 1,0,0,1,0,0,1,0,0,1, 0,1,0,0,0,1,0,0,0,1, 0,0,1,1,1,0,0,0,0,1, 1,1,1,0,0,0,0,0,0,1), nr=10,byrow=TRUE) } ccl.mat <- cclFun(tmat)
This function creates a height-mask as a grid based on given dimension and coordinates.
createHeightmask(dataset.height, dimension, origin, resolution=1)
createHeightmask(dataset.height, dimension, origin, resolution=1)
dataset.height |
A dataframe containing the longitude and lattitude of the grid cell location as 'long' and 'lat' and the height of the cell as 'height'. If the value of 'dataset.height' is 'NULL', the returned grid contains 0 as height-information of every cell. |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
This routine creates a height-mask as a grid. As Input a dataset with height-information is needed. The grid will be created with a given dimension.
This function returns a grid which contains the height information of the observed area.
Maximilian Lange, Sven Lautenbach
##load data data(dataset.all.species) data(dataset.height) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create height-matrix height.matrix <- createHeightmask(dataset.height, dimension, origin, resolution=1)
##load data data(dataset.all.species) data(dataset.height) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create height-matrix height.matrix <- createHeightmask(dataset.height, dimension, origin, resolution=1)
This function creates a levelplot of the result-grid of species range estimation and saves it as a PNG-File.
createImage(grid, landwatermask, image.title, directory, filename, origin, parts=10, resolution=1)
createImage(grid, landwatermask, image.title, directory, filename, origin, parts=10, resolution=1)
grid |
The grid that should be plotted. It contains the weighted species richness information. |
landwatermask |
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0. |
image.title |
The heading of the created image. |
directory |
The directory in which the image should be stored. |
filename |
The filename of the created PNG-File. |
origin |
The geographic coordinates of the origin of the grid. |
parts |
An Integer value determining the number of divisions in the colorkey of the created image. |
resolution |
The resolution of the grid in (geographical) degree. |
This routine creates a levelplot of the weighted species richness information and stores it as a PNG-File. The package lattice is required.
The return type is boolean. The value is TRUE if the image-creation was successful and FALSE if the image-creation has failed.
Maximilian Lange, Sven Lautenbach
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) ##create image ## Not run: image.success <- createImage(species.richness.weighted, landwatermask.nocoast, image.title="Test", directory=getwd(), filename="species.richness.test01.png", origin, parts=10, resolution=1) print(image.success) ## End(Not run)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) ##create image ## Not run: image.success <- createImage(species.richness.weighted, landwatermask.nocoast, image.title="Test", directory=getwd(), filename="species.richness.test01.png", origin, parts=10, resolution=1) print(image.success) ## End(Not run)
This function creates a land-water-mask as a grid based on given dimension and coordinates.
createLandwatermask(dataset.landwater, dimension, origin, resolution=1)
createLandwatermask(dataset.landwater, dimension, origin, resolution=1)
dataset.landwater |
A dataset containing the percentage of land on a cell of a grid. The coordinates of the cell should be given as longitude (named: long) and lattude (named: lat) and the percentage of land shoud be named landsum. If the value of 'dataset.landwater' is 'NULL', a grid containing only land-cells will be created. |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
This routine creates a land-water-mask as a grid. As Input a dataset with land-water-information is needed. The grid will be created with a given dimension.
This function returns a grid which contains the land-water information of the observed area. The value of cells containing land is 0, the value of water-cells is -1.
Maximilian Lange, Sven Lautenbach
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1)
This routine creates a grid containing the species occurrences.
createNonInterpolatedGrid(dataset.all.species, dimension, origin, resolution=1, all.species=-1)
createNonInterpolatedGrid(dataset.all.species, dimension, origin, resolution=1, all.species=-1)
dataset.all.species |
A dataset containing all observed species with their ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
all.species |
The vector with the numbers of the species which should be mentioned. If the first value is -1, all species in the database will be added to the grid. |
This routine creates a grid and adds all species mentioned in 'all.species' to it.
A grid containing the species occurrences without interpolation.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) resolution <- 1 all.species <- -1 ##create grid containing species occurrences species.occurrences <- createNonInterpolatedGrid(dataset.all.species, dimension, origin, resolution, all.species)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) resolution <- 1 all.species <- -1 ##create grid containing species occurrences species.occurrences <- createNonInterpolatedGrid(dataset.all.species, dimension, origin, resolution, all.species)
This function adds the species occurrence data to a new grid with given dimension, shift and resolution.
data.into.Grid(dataset.one.species, dimension, origin, resolution=1)
data.into.Grid(dataset.one.species, dimension, origin, resolution=1)
dataset.one.species |
A dataset containing one species with its ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of the occurrence locations of that species. |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
This routine adds the species occurrence data to the grid through adding their location as a point into it.
This function returns a grid which contains the species occurrence information.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) #extract datasets of one species out of database dataset.one.species <- extract.species(dataset.all.species, 3) ##add species occurrence information to grid grid <- data.into.Grid(dataset.one.species, dimension, origin, resolution=1)
##load data data(dataset.all.species) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) #extract datasets of one species out of database dataset.one.species <- extract.species(dataset.all.species, 3) ##add species occurrence information to grid grid <- data.into.Grid(dataset.one.species, dimension, origin, resolution=1)
This data set gives an example of angiosperm species and their occurrence in southern america.
A dataframe containing the longitude and lattitude of the occurrence location as 'long' and 'lat' and the species ID as 'speciesID'.
Angiosperm Database
Morawetz, W. and Raedig, C. (2007). Angiosperm biodiversity, endemism and conservation in the Neotropics. Taxon 56:1245-1254.
This data set containes the height of 1 degree grid cells of southern america.
A dataframe containing the longitude and lattitude of the grid cell location as 'long' and 'lat' and the height of the cell as 'height'.
This data set containes the percentage of land/water of 1 degree grid cells of southern america.
A dataframe containing the longitude and lattitude of the grid cell location as 'long' and 'lat' and the percentage of land/water as landsum.
This function checks if an edge would cross a water or mountain surface.
edgeNotValid(grid,point.a, point.b, landwatermask, upperbound)
edgeNotValid(grid,point.a, point.b, landwatermask, upperbound)
grid |
A grid to which the edge should be added if it hits no water or mountain surfaces. |
point.a |
A point in a grid given by its row and column. |
point.b |
A point in a grid given by its row and column. |
landwatermask |
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0. Additional, height-informations could be added for land surfaces. In this case, take care of the 'upperbound' value. |
upperbound |
This value determines the height (based on values in 'landwatermask') which is considered to be a barrier for species distribution. |
This function checks if an edge would cross a water or mountain surface.
A boolean value which determines if the edge would cross a water or mountain surface.
Maximilian Lange, Sven Lautenbach
##load data data(dataset.all.species) data(dataset.landwater) ##initialize variables distance <- 5 ##create grid parameters dimension <- getDimension(dataset.all.species) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin) ##extract datasets of one species out of database dataset.one.species <- extract.species(dataset.all.species, 3) ##create grid grid <- matrix(0,dimension[1],dimension[2]) ##add points grid <- data.into.Grid(dataset.one.species, dimension, origin) ##points to list points <- which(grid > 0) points.xy <- list() for (i in 1:length(points)){ points.xy[[i]] <- c(ifelse((points[i] %% dimension[1]) == 0, dimension[1], points[i] %% dimension[1]), ceiling(points[i]/dimension[1])) } ##Edge-Water-Test check <- edgeNotValid(grid, points.xy[[1]],points.xy[[2]], landwatermask.nocoast, 1000) print(check)
##load data data(dataset.all.species) data(dataset.landwater) ##initialize variables distance <- 5 ##create grid parameters dimension <- getDimension(dataset.all.species) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin) ##extract datasets of one species out of database dataset.one.species <- extract.species(dataset.all.species, 3) ##create grid grid <- matrix(0,dimension[1],dimension[2]) ##add points grid <- data.into.Grid(dataset.one.species, dimension, origin) ##points to list points <- which(grid > 0) points.xy <- list() for (i in 1:length(points)){ points.xy[[i]] <- c(ifelse((points[i] %% dimension[1]) == 0, dimension[1], points[i] %% dimension[1]), ceiling(points[i]/dimension[1])) } ##Edge-Water-Test check <- edgeNotValid(grid, points.xy[[1]],points.xy[[2]], landwatermask.nocoast, 1000) print(check)
This function evaluates the result grids of species richness estimation.
evaluate(result.grid.one, result.grid.two, title.one="Histogramm of species richness", title.two="Histogramm of species richness", xmax=400, ymax=1000, directory=getwd(), filename="histogramm.png")
evaluate(result.grid.one, result.grid.two, title.one="Histogramm of species richness", title.two="Histogramm of species richness", xmax=400, ymax=1000, directory=getwd(), filename="histogramm.png")
result.grid.one |
A result grid of species richness estimation. If the value is 'NULL', the grid is ignored and only the other grid will be included in the resulting png-file. |
result.grid.two |
A result grid of species richness estimation. If the value is 'NULL', the grid is ignored and only the other grid will be included in the resulting png-file. |
title.one |
The title for the histogramm of the first grid ('result.grid.one'). |
title.two |
The title for the histogramm of the second grid ('result.grid.two'). |
xmax |
The maximum value of the abscissa respectively the maximum number of species in the grid. |
ymax |
The maximum value of the ordinate respectively the maximum frequency shown in the histogramm. |
directory |
The directory the png-file is created in. |
filename |
The name of the created png-file. |
This routine evaluates the result grids of a species richness estimation (details in Raedig et al. 2010). It creates one or two histogramms (depending on input) of the species occurrences with additional information about the total number of species of the grid and other statistic scores. It is possible to create on png-file for every result grid or to compare two result-grids in one png-file, depending on how many grids are defined as input.
This function creates a png-file with one or two histogramms (depending on input) and additional statistic informations.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
#load data data(dataset.all.species) data(dataset.landwater) #create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) #create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) #estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) #evaluation ## Not run: evaluate(species.richness.weighted, NULL, title.one="Histogramm 1") ## End(Not run)
#load data data(dataset.all.species) data(dataset.landwater) #create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) #create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) #estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) #evaluation ## Not run: evaluate(species.richness.weighted, NULL, title.one="Histogramm 1") ## End(Not run)
This function exports the result grid as a GeoTiff.
export_tif(grid, origin, resolution, epsg_code, directory=getwd(), filename="grid.tif")
export_tif(grid, origin, resolution, epsg_code, directory=getwd(), filename="grid.tif")
grid |
The grid that should be exported. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
epsg_code |
The epsg_code of the origin coordines. Defauls to 4326. |
directory |
The directory in which the file will be created. |
filename |
The name of the created GeoTiff-file. |
This routine exports a grid as a GeoTiff-file.
Maximilian Lange
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) ##export ## Not run: export_tif(species.richness.weighted, origin, resolution=1, epsg_code="4326", directory=getwd(), filename="species.richness.tif") ## End(Not run)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) ##export ## Not run: export_tif(species.richness.weighted, origin, resolution=1, epsg_code="4326", directory=getwd(), filename="species.richness.tif") ## End(Not run)
This function extracts the datasets of one species out of a database filled with species and their occurrence locations.
extract.species(dataset.all.species, species.number)
extract.species(dataset.all.species, species.number)
dataset.all.species |
A dataset containing all observed species with their ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
species.number |
The number of the species which should be extracted. |
This function extracts the datasets of one species out of a database filled with species (named by their speciesID) and their occurrence locations mentioned with lattitude (named lat) and longitude (named long).
This function returns a dataset which contains the species occurrence locations.
Maximilian Lange, Sven Lautenbach
##load data data(dataset.all.species) #extract datasets of one species (with speciesID=3) out of database dataset.one.species <- extract.species(dataset.all.species, 3)
##load data data(dataset.all.species) #extract datasets of one species (with speciesID=3) out of database dataset.one.species <- extract.species(dataset.all.species, 3)
This function fills all bounded areas in a grid.
fill.Areas(grid, landwatermask)
fill.Areas(grid, landwatermask)
grid |
A grid in which the areas should be filled. Cells with values greater than zero represent the bounds, cells with values lower or equal zero will be filled with value 1 if they are bounded. |
landwatermask |
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0. Cells with negative values will not be filled. |
This function fills all bounded areas in a grid.
The grid with filled areas.
Maximilian Lange, Sven Lautenbach
##initialize data m <- matrix(0,10,10) m[2:8,2] <- 1 m[2:8,8] <- 1 m[2,2:8] <- 1 m[8,2:8] <- 1 ##initialize mask (in this case: empty mask) mask <- matrix(0,10,10) ##calculate the distance of the two points m <- fill.Areas(m, mask) image(m)
##initialize data m <- matrix(0,10,10) m[2:8,2] <- 1 m[2:8,8] <- 1 m[2,2:8] <- 1 m[8,2:8] <- 1 ##initialize mask (in this case: empty mask) mask <- matrix(0,10,10) ##calculate the distance of the two points m <- fill.Areas(m, mask) image(m)
A function that creates an array of subsamples of a dataset.
generate.subsamples(number.of.occurrences, fold, loocv.limit)
generate.subsamples(number.of.occurrences, fold, loocv.limit)
number.of.occurrences |
The number of occurrences of the species. |
fold |
The number of groups which should be created if the number of occurrences is greater than loocv.limit. |
loocv.limit |
The limit below which the subsamples are created for a leave-one-out-cross-validation instead of a k-fold-cross-validation. |
This routine creates subsamples of species occurrences based on the number of occurrences of the chosen species and the number of groups which should be created. If the number of occurrences of the chosen species is below the loocv.limit, the groups contain only one member and the fold value will be ignored. The subsamples can be used for a k-fold or leave-one-out-cross-validation.
This function returns a grid which contains the subsamples.
Maximilian Lange, Sven Lautenbach
subsamples <- generate.subsamples(15,3,5)
subsamples <- generate.subsamples(15,3,5)
This function calculates the dimension of the grid which should be used for a species richness estimation.
getDimension(dataset.all.species, resolution=1)
getDimension(dataset.all.species, resolution=1)
dataset.all.species |
A dataset containing all observed species with their ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
resolution |
The resolution of the grid in (geographical) degree. |
This function calculates the dimension of the grid which should be used for a species richness estimation on a given database of species occurrence locations.
The dimension which is needed to create a grid used for a species richness estimation on a given database of species occurrence locations.
Maximilian Lange, Sven Lautenbach
##load data data(dataset.all.species) #extract dimension out of the database dimension <- getDimension(dataset.all.species, resolution=1) print(dimension)
##load data data(dataset.all.species) #extract dimension out of the database dimension <- getDimension(dataset.all.species, resolution=1) print(dimension)
This function calculates the distance of two points in a grid.
getDistance(point.a, point.b, resolution=1)
getDistance(point.a, point.b, resolution=1)
point.a |
A point in a grid given by its row and column. |
point.b |
A point in a grid given by its row and column. |
resolution |
The resolution of the grid in (geographical) degree. |
This function calculates the distance of two points in a grid by the Pythagorean theorem.
The distance of the two points as an numeric value based on geographical degrees.
Maximilian Lange, Sven Lautenbach
##initialize data point.a <- c(5,8) point.b <- c(10,3) ##calculate the distance of the two points distance <- getDistance(point.a,point.b, resolution=1) print(distance)
##initialize data point.a <- c(5,8) point.b <- c(10,3) ##calculate the distance of the two points distance <- getDistance(point.a,point.b, resolution=1) print(distance)
This function extracts the row number of narrow endemic species in the given dataset.
getNarrowEndemics(dataset.all.species, all.species, narrow.endemic.limit, dimension, origin, resolution)
getNarrowEndemics(dataset.all.species, all.species, narrow.endemic.limit, dimension, origin, resolution)
dataset.all.species |
A dataset containing all observed species with their ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
all.species |
A vector with the numbers of the species which should be mentioned. If the first value is -1, all species in the database will be used. |
narrow.endemic.limit |
This value determines the limit of points and the maximum distance of these points up to which a species is considered as narrow endemic species. |
dimension |
The dimension of the grid which should be processed. |
origin |
The geographic coordinates of the origin of the grid which should be processed. |
resolution |
The resolution of the grid which should be processed in (geographical) degree. |
This function extracts the row numbers of narrow endemic species in the given datasets.
This function returns a vector containing the row numbers of narrow endemic species in the given dataset.
Maximilian Lange, Claudia Raedig
## load data data(dataset.all.species) ## create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ## search narrow endemic species in row 100 to 200 in the dataset narrow.endemic.species <- getNarrowEndemics(dataset.all.species, all.species=100:200, narrow.endemic.limit=8, dimension, origin, resolution=1)
## load data data(dataset.all.species) ## create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ## search narrow endemic species in row 100 to 200 in the dataset narrow.endemic.species <- getNarrowEndemics(dataset.all.species, all.species=100:200, narrow.endemic.limit=8, dimension, origin, resolution=1)
This function calculates the origin of the grid used for a species richness estimation.
getOrigin(dataset.all.species)
getOrigin(dataset.all.species)
dataset.all.species |
A dataset containing all observed species with their ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
This function calculates the coordinates of the origin of the grid which should be used for a species richness estimation.
The coordinates of the origin of the grid used for species richness estimation.
Maximilian Lange, Sven Lautenbach
##load data data(dataset.all.species) #extract coordinates of origin out of database origin <- getOrigin(dataset.all.species) print(origin)
##load data data(dataset.all.species) #extract coordinates of origin out of database origin <- getOrigin(dataset.all.species) print(origin)
This routine searches clusters in the result grid of species richness estimation.
searchClusters(species.richness, dimension, origin, resolution, clusterlimit)
searchClusters(species.richness, dimension, origin, resolution, clusterlimit)
species.richness |
The grid that should be adjusted. It contains the result of species richness estimation or cross-validation. |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
clusterlimit |
The limit under which values of 'species.richness' should not be used to build clusters. |
This routine searches clusters in the result grid of species richness estimation to find centers of species richness.
This function returns a list containing vectors of the position of pixels which belong together.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) ##prepare clustersearch clusterlimit <- 100 ##adjust species richness clusterlist <- searchClusters(species.richness.weighted, dimension, origin, resolution=1, clusterlimit)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=3000, all.species=1:2) ##prepare clustersearch clusterlimit <- 100 ##adjust species richness clusterlist <- searchClusters(species.richness.weighted, dimension, origin, resolution=1, clusterlimit)
This function estimates the species range based on given occurrences of one species.
species.range(dataset.one.species, distance, dimension, origin, resolution=1, landwatermask, upperbound, cross.validation=FALSE)
species.range(dataset.one.species, distance, dimension, origin, resolution=1, landwatermask, upperbound, cross.validation=FALSE)
dataset.one.species |
A dataset containing one species with its ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of the occurrence locations of that species. |
landwatermask |
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0. Additional, height-informations could be added for land surfaces. In this case, take care of the 'upperbound' value. |
distance |
The maximum distance in which two occurrences are considered as related occurrences. These two occurrences will be connected with an edge. |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
upperbound |
This value determines the height (based on values in 'landwatermask') which is considered to be a barrier for species distribution. |
cross.validation |
A logical value determining wether a cross-validation is performed. |
This routine estimates the species range based on given occurrences of one species through a geometric interpolation model (details in Raedig et al. 2010).
This function returns a grid which contains the species range information.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##extract datasets of one species out of database dataset.one.species <- extract.species(dataset.all.species, 3) ##estimate species range species.range.tmp <- species.range(dataset.one.species, distance=5, dimension, origin, resolution=1, landwatermask.nocoast)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##extract datasets of one species out of database dataset.one.species <- extract.species(dataset.all.species, 3) ##estimate species range species.range.tmp <- species.range(dataset.one.species, distance=5, dimension, origin, resolution=1, landwatermask.nocoast)
This function estimates the species richness based on given species occurrences.
species.richness(dataset.all.species, landwatermask, distances=2:10, weight=0.5, dimension, origin, resolution=1, upperbound, all.species=-1, silent=TRUE, do.parallel=FALSE)
species.richness(dataset.all.species, landwatermask, distances=2:10, weight=0.5, dimension, origin, resolution=1, upperbound, all.species=-1, silent=TRUE, do.parallel=FALSE)
dataset.all.species |
A dataset containing the species with their ID (named: speciesID)and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
landwatermask |
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0. Additional, height-informations could be added for land surfaces. In this case, take care of the 'upperbound' value. |
distances |
The distances which will be used for species range estimation. |
weight |
The tuning parameter of the weighting procedure (details in Raedig et al. 2010). |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
upperbound |
This value determines the height (based on values in 'landwatermask') which is considered to be a barrier for species distribution. |
all.species |
The vector with the numbers of the species which should be mentioned. If the first value is -1, all species in the database will be used for species richness estimation. |
silent |
A boolean flag that determines wether the report of status messages should be suppressed or not. |
do.parallel |
A boolean flag determining wether the function uses the 'foreach'-package to estimate species richness via parallel processing. |
This routine estimates the species richness based on given species occurrences through a geometric interpolation model (details in Raedig et al. 2010).
This function returns a grid which contains the weighted species richness information.
Maximilian Lange, Sven Lautenbach, Claudia Raedig
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=5, all.species=1:2, silent=TRUE)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness(dataset.all.species, landwatermask.nocoast, distances=1:5, weight=0.5, dimension, origin, resolution=1, upperbound=5, all.species=1:2, silent=TRUE)
This function cross-validates the species richness based on given species occurrences.
species.richness.cv(dataset.all.species, landwatermask, fold=5, loocv.limit=10, distances=3:10, weight=0.5, dimension, origin, resolution=1, upperbound, all.species=-1, silent=TRUE, do.parallel=FALSE)
species.richness.cv(dataset.all.species, landwatermask, fold=5, loocv.limit=10, distances=3:10, weight=0.5, dimension, origin, resolution=1, upperbound, all.species=-1, silent=TRUE, do.parallel=FALSE)
dataset.all.species |
A dataset containing the species with their ID (named: speciesID)and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
landwatermask |
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0. Additional, height-informations could be added for land surfaces. In this case, take care of the 'upperbound' value. |
fold |
The number of groups which should be created if the number of occurrences is greater than loocv.limit. |
loocv.limit |
The limit below which the subsamples are created for a leave-one-out-cross-validation instead of a k-fold-cross-validation. |
distances |
The distances which will be used for species range estimation. |
weight |
The tuning parameter of the weighting procedure (details in Raedig et al. 2010). |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
upperbound |
This value determines the height (based on values in 'landwatermask') which is considered to be a barrier for species distribution. |
all.species |
The vector with the numbers of the species which should be mentioned. If the first value is -1, all species in the database will be used for species richness estimation. |
silent |
A boolean flag that determines wether the report of status messages should be suppressed or not. |
do.parallel |
A boolean flag determining wether the function uses the 'foreach'-package to cross-validate via parallel processing. |
This routine cross-validates the species richness based on given species occurrences through a geometric interpolation model (details in Raedig et al. 2010).
This function returns a grid which contains the cross-validated species richness information.
Maximilian Lange, Sven Lautenbach, Claudia Raedig
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness.cv(dataset.all.species, landwatermask.nocoast, fold=5, loocv.limit=10, distances=2:5, weight=0.5, dimension, origin, resolution=1, upperbound=5, all.species=1:2)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.weighted <- species.richness.cv(dataset.all.species, landwatermask.nocoast, fold=5, loocv.limit=10, distances=2:5, weight=0.5, dimension, origin, resolution=1, upperbound=5, all.species=1:2)
The main function to estimate or cross-validate the species richness based on given species occurrences.
species.richness.main(dataset.all.species, dataset.landwater, dataset.height, distances=1:10, weight=0.5, resolution=1, narrow.endemic=FALSE, narrow.endemic.limit=5, upperbound=5, cross.validation=FALSE, fold=5, loocv.limit=10, create.image=FALSE, image.title="Interpolated Species Richness", directory=getwd(), filename="species.richness.png", evaluation=FALSE, eval.title="Histogramm", adjust=FALSE, clusterlimit=100, predefinedClusterlist=NULL, all.species=-1, export=FALSE, exportname="species.richness.tif", noninterpolatedgrid=NULL, silent=TRUE, do.parallel=FALSE)
species.richness.main(dataset.all.species, dataset.landwater, dataset.height, distances=1:10, weight=0.5, resolution=1, narrow.endemic=FALSE, narrow.endemic.limit=5, upperbound=5, cross.validation=FALSE, fold=5, loocv.limit=10, create.image=FALSE, image.title="Interpolated Species Richness", directory=getwd(), filename="species.richness.png", evaluation=FALSE, eval.title="Histogramm", adjust=FALSE, clusterlimit=100, predefinedClusterlist=NULL, all.species=-1, export=FALSE, exportname="species.richness.tif", noninterpolatedgrid=NULL, silent=TRUE, do.parallel=FALSE)
dataset.all.species |
A dataset containing all observed species with their ID (named: speciesID) and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
dataset.landwater |
A dataset containing the percentage of land on a cell of a grid. The coordinates of the cell should be given as longitude (named: long) and lattude (named: lat) and the percentage of land shoud be named landsum. If the value of 'dataset.landwater' is 'NULL', the land-water-information has no effect on the species richness estimation. |
dataset.height |
A dataset containing the longitude and lattitude of the grid cell location as 'long' and 'lat' and the height of the cell as 'height'. If the value of 'dataset.height' is 'NULL', the height-information has no effect on the species richness estimation. |
distances |
The distances used for species range estimation or cross validation. |
weight |
The tuning parameter of the weighting procedure (details in Raedig et al. 2010). |
resolution |
The resolution of the grid in (geographical) degree. |
narrow.endemic |
A boolean flag that determines if only narrow endemic species should be considered in species richness estimation. |
narrow.endemic.limit |
This value determines the limit of points and the maximum distance of these points up to which a species is considered as narrow endemic species. |
upperbound |
This value determines the height which is considered to be a barrier for species distribution. |
cross.validation |
A logical value determining wether a cross-validation is performed. If the value is true, the parameters narrow.endemic and narrow.endemic.limit will be ignored. |
fold |
The number of groups which should be created if the number of occurrences is greater than loocv.limit. |
loocv.limit |
The limit below which the subsamples are created for a leave-one-out-cross-validation instead of a k-fold-cross-validation. |
create.image |
A boolean flag that determines if an image (PNG-File) is created. |
image.title |
The heading of the created image. |
directory |
The directory in which the created files should be stored. |
filename |
The filename of the created PNG-Files. |
evaluation |
A boolean value determining wether the routine 'evaluate' is used or not. If the value is true, a PNG-File with a histogramm of the result grid will be created. |
eval.title |
The heading of the created histogramm. |
adjust |
A boolean value determining wether an adjustment of the result grid should be done or not. |
clusterlimit |
The limit below values of 'species.richness' should not be used to build clusters. Each cluster will be adjusted with an own centre of species richness. |
predefinedClusterlist |
A list of vectors of pixelpositions (created by 'searchClusters') which are spatial related. The default value is NULL because the list will be created if 'adjust' is 'TRUE', but it may be useful for robustness estimation, because the cross-validation result should be adjusted with the same clusterlist as the related species richness estimation (and without a pre-defined clusterlist, other clusters will be build). |
all.species |
A vector with the identification numbers of the considered species. If the first value is -1, all species in the database will be used. |
export |
A boolean value that determines if the routine should export the results as GeoTiff. |
exportname |
The name of the created GeoTiff-file. |
noninterpolatedgrid |
A grid containing the species occurrences (could be created via function 'createNonInterpolatedGrid'). If the value of this parameter is 'NULL', it will be created if an adjustment should be done. The parameter may be usefull to save time while processing more than one 'species.richness.main'. |
silent |
A boolean flag that determines wether the report of status messages should be suppressed or not. |
do.parallel |
A boolean flag determining wether the function uses the 'foreach'-package to process in parallel. |
This routine is the main function of this package. It either estimates or cross-validates the species richness based on given species occurrences using a geometric interpolation model (details in Raedig et al. 2010).
This function returns a grid which contains either the weighted or the cross-validated species richness information. Additionally, an image (PNG-File) of that grid can be created.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) data(dataset.height) ##estimate species richness species.richness.weighted <- species.richness.main(dataset.all.species, dataset.landwater, dataset.height, distances=1:5, weight=0.5, resolution=1, narrow.endemic=FALSE, narrow.endemic.limit=5, upperbound=5, cross.validation=FALSE, fold=5, loocv.limit=10, create.image=FALSE, directory=getwd(), filename="species.richness.png", all.species=1:2, export=FALSE)
##load data data(dataset.all.species) data(dataset.landwater) data(dataset.height) ##estimate species richness species.richness.weighted <- species.richness.main(dataset.all.species, dataset.landwater, dataset.height, distances=1:5, weight=0.5, resolution=1, narrow.endemic=FALSE, narrow.endemic.limit=5, upperbound=5, cross.validation=FALSE, fold=5, loocv.limit=10, create.image=FALSE, directory=getwd(), filename="species.richness.png", all.species=1:2, export=FALSE)
This function estimates the species richness for a given distance based on given species occurrences without using weighting factor.
species.richness.nonweighted(dataset.all.species, landwatermask, distance=10, dimension, origin, resolution=1, upperbound, all.species=-1, silent=TRUE, do.parallel=FALSE)
species.richness.nonweighted(dataset.all.species, landwatermask, distance=10, dimension, origin, resolution=1, upperbound, all.species=-1, silent=TRUE, do.parallel=FALSE)
dataset.all.species |
A dataset containing the species with their ID (named: speciesID)and the longitude (named: long) and latitude (named: lat) of their occurrence location. |
landwatermask |
A grid containing the land-water-information of the observed area. If a grid cell containes no land, the value of the cell in the landwatermask is -1, otherwise it is 0. Additional, height-informations could be added for land surfaces. In this case, take care of the 'upperbound' value. |
distance |
The distance which will be used for species range estimation. |
dimension |
The dimension of the processed grid. |
origin |
The geographic coordinates of the origin of the grid. |
resolution |
The resolution of the grid in (geographical) degree. |
upperbound |
This value determines the height (based on values in 'landwatermask') which is considered to be a barrier for species distribution. |
all.species |
The vector with the numbers of the species which should be mentioned. If the first value is -1, all species in the database will be used for species richness estimation. |
silent |
A boolean flag that determines wether the report of status messages should be suppressed or not. |
do.parallel |
A boolean flag determining wether the function uses the 'foreach'-package to estimate species richness via parallel processing. |
This routine estimates the species richness for a given distance (without weighted summation) based on given species occurrences through a geometric interpolation model (details in Raedig et al. 2010).
This function returns a grid which contains the species richness information for a given distance.
Maximilian Lange, Sven Lautenbach
Raedig, C., Dorman, C.F., Hildebrandt, A. and Lautenbach, S. (2010). Reassessing Neotropical angiosperm distribution patterns based on monographic data: a geometric interpolation approach. Biodivers Conserv, 19, 1523-1546.
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.noweight <- species.richness.nonweighted(dataset.all.species, landwatermask.nocoast, distance=5, dimension, origin, resolution=1, upperbound=5, all.species=1:2)
##load data data(dataset.all.species) data(dataset.landwater) ##create grid parameters dimension <- getDimension(dataset.all.species, resolution=1) origin <- getOrigin(dataset.all.species) ##create landwatermask landwatermask.nocoast <- createLandwatermask(dataset.landwater, dimension, origin, resolution=1) ##estimate species richness species.richness.noweight <- species.richness.nonweighted(dataset.all.species, landwatermask.nocoast, distance=5, dimension, origin, resolution=1, upperbound=5, all.species=1:2)