Title: | Creates Bivariate Maps |
---|---|
Description: | Contains functions mainly focused to plotting bivariate maps. |
Authors: | Jose Hidasi-Neto [aut, cre] |
Maintainer: | Jose Hidasi-Neto <[email protected]> |
License: | GPL-3 |
Version: | 1.7 |
Built: | 2025-03-13 05:48:49 UTC |
Source: | https://github.com/hidasi/bivariatemaps |
Uses a sample of species to get the phylogeny that starts at the common ancestor of the sample.
ancestree(sample, tree)
ancestree(sample, tree)
sample |
A data frame with species in columns' names (check out example link). |
tree |
.tre phylogenetic tree of species. |
A phylogeny that starts at the common ancestor of the provided sample.
# https://rfunctions.blogspot.com/2013/04/ancestree-function-get-phylogeny-that.html
# https://rfunctions.blogspot.com/2013/04/ancestree-function-get-phylogeny-that.html
Generate infinite minigames based on the Astrarium minigame, from "Dragon Age: Inquisition". You have to click on the stars (asterisks) to find a path that that reveals the same image as shown while not repeating connections already made once. When it begins (by typing "astRaRium()" ), it will ask you for the desired number of stars and the number of links between pairs of stars. A good number is 12 and 9, respectively.
astRaRium()
astRaRium()
You play the game. You can succeed or fail.
# https://rfunctions.blogspot.com/2021/05/astrarium2-r-game-about-linking-stars.html
# https://rfunctions.blogspot.com/2021/05/astrarium2-r-game-about-linking-stars.html
Uses a 'gridded' shapefile and its corresponding community data matrix to calculate beta diversity for each focal grid cell in relation to its neighbor cells (for example, 8 nearest neighbors).
betagrid( gridshp, comp, xfeature, yfeature, radius, phylotree, phylobeta = F, index = "sorensen" )
betagrid( gridshp, comp, xfeature, yfeature, radius, phylotree, phylobeta = F, index = "sorensen" )
gridshp |
Gridded Shapefile ("SpatialPolygonsDataFrame"). |
comp |
community data matrix (species occurrence on each grid cell). |
xfeature |
number of the feature within the gridded shapefile corresponding to the longitude. |
yfeature |
number of the feature within the grid shapefile corresponding to the latitude. |
radius |
the radius (in degrees) that define the maximum distance to select neighbor cells (for example, use the resolution of the gridded shapefile). |
phylotree |
optional phylogenetic tree ("phylo" class). It can also be a "phylo" class functional dendrogram. |
phylobeta |
Optional boolean whether or not to calculate or not phylogenetic beta diversity (see "phylo.beta.pair" function in "betapart" package) instead of the usual beta diversity (see "beta.pair" function in "betapart" package). Default is F. |
index |
to calculate "sorensen" or "jaccard". Default is "sorensen". |
A data frame with values of mean turnover, mean nestedness, and mean beta diversity for each grid cell.
# https://rfunctions.blogspot.com/2015/08/calculating-beta-diversity-on-grid.html
# https://rfunctions.blogspot.com/2015/08/calculating-beta-diversity-on-grid.html
Creates a Bivariate Map using two rasters and a color matrix created with colmat() function.
bivariate.map( rasterx, rastery, colormatrix, nquantiles = 10, trivariate = F, rasterz )
bivariate.map( rasterx, rastery, colormatrix, nquantiles = 10, trivariate = F, rasterz )
rasterx |
raster |
rastery |
raster |
colormatrix |
color matrix from colmat() function |
nquantiles |
number of quantiles in color matrix (same as used when using colmat() function) |
trivariate |
boolean indicating if should use a third raster for a "trivariate" map where the third variable corresponds to the transparency (alpha) of colors. |
rasterz |
raster (only if trivariate=T) |
A plot with the bivariate map.
# https://rfunctions.blogspot.com/2015/03/bivariate-maps-bivariatemap-function.html
# https://rfunctions.blogspot.com/2015/03/bivariate-maps-bivariatemap-function.html
Creates a color matrix to be used in bivariate.map() function.
colmat( nquantiles = 10, upperleft = "blue", upperright = "red", bottomleft = "grey", bottomright = "yellow", xlab = "x label", ylab = "y label" )
colmat( nquantiles = 10, upperleft = "blue", upperright = "red", bottomleft = "grey", bottomright = "yellow", xlab = "x label", ylab = "y label" )
nquantiles |
numeric variable for number of quantiles in color matrix |
upperleft |
upperleft color of color matrix |
upperright |
upperright color of color matrix |
bottomleft |
bottomleft color of color matrix |
bottomright |
bottomright color of color matrix |
xlab |
character variable |
ylab |
character variable |
Two outputs: a color matrix object to be used in bivariate.map() function, and a plot of the color matrix.
col.matrix<-colmat(nquantiles=10, xlab="My x label", ylab="My y label") # https://rfunctions.blogspot.com/2015/03/bivariate-maps-bivariatemap-function.html
col.matrix<-colmat(nquantiles=10, xlab="My x label", ylab="My y label") # https://rfunctions.blogspot.com/2015/03/bivariate-maps-bivariatemap-function.html
Calculates ED, EcoD, EDGE, EcoDGE, and EcoEDGE, from Red List Categories, a phylogenetic tree, and a functional dendrogram.
EcoEDGE( category, phylo, func, funcweight = 0.5, phyloweight = 0.5, polytomy = "isaac" )
EcoEDGE( category, phylo, func, funcweight = 0.5, phyloweight = 0.5, polytomy = "isaac" )
category |
data frame where the first column contains the red list categories of species. |
phylo |
phylogenetic tree of species. |
func |
functional dendrogram of species. |
funcweight |
weight of ecological distinctiveness on the calculation of EcoEDGE scores. |
phyloweight |
weight of evolutionary distinctiveness on the calculation of EcoEDGE scores. Sum of funcweight and phyloweight must be equal to 1. |
polytomy |
how to handle polytomies in the phylogeny and the functional dendrogram. See "ed.calc" function for details. |
A table with calculated values for each variable.
# https://rfunctions.blogspot.com/2021/03/ecoedge-ecologically-and-evolutionarily.html
# https://rfunctions.blogspot.com/2021/03/ecoedge-ecologically-and-evolutionarily.html
Overlay a shapefile with a grid. Then, excludes grid cells that do not cover a specific amount of the Shape area.
GridFilter(shape, resol = 1, prop = 0)
GridFilter(shape, resol = 1, prop = 0)
shape |
A shapefile. |
resol |
The resolution (in degrees) of the grid you want to overlay. The default is 1 degree of longitude and latitude. |
prop |
The minimum value of area covered by the grid cell. The default is 0 (i.e. it does not delete any grid cell). |
A gridded shapefile.
# https://rfunctions.blogspot.com/2014/12/gridfilter-intersect-grid-with-shape.html
# https://rfunctions.blogspot.com/2014/12/gridfilter-intersect-grid-with-shape.html
Uses two occurrence matrices (from different time periods) to calculate temporal beta diversity for each site or grid cell.
tempbetagrid(oc1, oc2, index = "sorensen", phylotree, phylobeta = F)
tempbetagrid(oc1, oc2, index = "sorensen", phylotree, phylobeta = F)
oc1 |
Community data matrix (species occurrence on each grid cell). |
oc2 |
Second community data matrix (species occurrence on each grid cell) for another time period. |
index |
Calculate "sorensen" or "jaccard". Default is "sorensen". |
phylotree |
Optional phylogenetic tree ("phylo" class). It can also be a functional dendrogram. |
phylobeta |
Optional boolean indicating whether or not to calculate phylogenetic beta diversity (see "phylo.beta.pair" function in "betapart" package) instead of the usual beta diversity (see "beta.pair" function in "betapart" package). Default is F. |
A data frame with values of turnover, nestedness, beta diversity, and turnover/beta for each site or grid cell.
# https://rfunctions.blogspot.com/2016/10/calculating-temporal-beta-diversity-on.html
# https://rfunctions.blogspot.com/2016/10/calculating-temporal-beta-diversity-on.html