Title: | Estimation of the Relative Importance of Factors Affecting Species Distribution Based on Stability Concept |
---|---|
Description: | From output files obtained from the software 'ModestR', the relative contribution of factors to explain species distribution is depicted using several plots. A global geographic raster file for each environmental variable may be also obtained with the mean relative contribution, considering all species present in each raster cell, of the factor to explain species distribution. Finally, for each variable it is also possible to compare the frequencies of any variable obtained in the cells where the species is present with the frequencies of the same variable in the cells of the extent. |
Authors: | Castor Guisande Gonzalez |
Maintainer: | Castor Guisande Gonzalez <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.2 |
Built: | 2024-12-07 06:27:00 UTC |
Source: | CRAN |
Latitude and longitude of all administrative areas
data(adworld)
data(adworld)
A matrix of many rows and 3 columns (Latitude, Longitude and name of the administrative area)
Latitude and longitude coordinates of the administrative areas were obtained from the web page https://www.openstreetmap.org.
It performs beanplots and boxplots with the contribution of environmental factors to explain the distribution of species.
ContrBB(data, vars, Level=NULL, Taxon=NULL, graph="beanplot", order="decreasing", side="no", beanlines="median", what=c(1,1,1,1), ll=NULL, border="black", OrderCat=NULL, LabelCat=NULL, XLAB="Variables", YLAB="Percentage of contribution to instability index", COLOR=NULL, LEGEND=NULL, MTEXT= NULL, TEXT=NULL, ResetPAR=TRUE, PAR=NULL, BEANPLOT=NULL, BOXPLOT=NULL)
ContrBB(data, vars, Level=NULL, Taxon=NULL, graph="beanplot", order="decreasing", side="no", beanlines="median", what=c(1,1,1,1), ll=NULL, border="black", OrderCat=NULL, LabelCat=NULL, XLAB="Variables", YLAB="Percentage of contribution to instability index", COLOR=NULL, LEGEND=NULL, MTEXT= NULL, TEXT=NULL, ResetPAR=TRUE, PAR=NULL, BEANPLOT=NULL, BOXPLOT=NULL)
data |
Data file, which it may be obtained using DataManager of ModestR. See details section for the explanation of the format of the data. |
vars |
Environmental factors. |
Level |
Optionaly, a taxonomic level may be selected, i.e., class, family, order, genus or species. |
Taxon |
Optionally, it is possible to work only with a selected species, just specifying the name of the taxon or taxa selected within the taxonomic level selected in the argument Level, i.e., name of the order, family, etc. Can be a vector, so several taxa. |
graph |
Type of plot: "beanplot" or "boxplot". |
order |
If it is NULL the categories are ordered as found in the argument vars, if it is "increasing" are ordered from lesser to greater median or mean according to the method selected in the argument beanlines, if it is "decreasing" are ordered from greater to lesser median or mean, if it is "alhaAZ" are ordered from A to Z and if it is "alphaZA" from Z to A. If the method selected in beanlines="quantiles", it is used the median for both "increasing" and "decreasing". |
side |
The side on which the beans are plot. Default is "no", for symmetric beans. The options "first", "second" and "both" are also supported. |
beanlines |
The method used for determining the average bean lines. Default is value "median", and other options are "mean" and "quantiles". |
what |
A vector of four booleans describing what to plot. In the following order, these booleans stand for the total average line, the beans, the bean average, and the beanlines. For example, what=c(0,0,0,1) produces a stripchart. |
ll |
Length of the beanline per point found. |
border |
Color of the border around the bean. |
OrderCat |
It allows to specify a vector with the order in which the categories are shown. If this argument is specified, the argument order is not taken into account. |
LabelCat |
It allows to specify a vector with the names of the categories. |
XLAB |
Legend of X axis. |
YLAB |
Legend of Y axis. |
COLOR |
Vector with the color of the categories or just one color for all categories. |
LEGEND |
It allows to include a legend to the graph. |
MTEXT |
It allows to add text on the margins of the graph. |
TEXT |
It allows to add text in any area of the inner part of the graph. |
ResetPAR |
If it is FALSE, the default condition of the function PAR is not placed and maintained those defined by the user in previous graphics. |
PAR |
It accesses the function PAR, allowing to modify different aspects of the graph. |
BEANPLOT |
It allows to specify the characteristics of the function beanplot of the beanplot package (Kampstra, 2008; Kampstra, 2015). |
BOXPLOT |
It allows to specify the characteristics of the function boxplot of graphics package. |
The CSV file required in the argument data has the following format: class, order, family, genus and species, along with the contribution of the environmental variables. This file may be obtained using ModestR (Garcia-Rosello et al., 2013; available at the web site using the following menu: Export/Export checked maps/To RWizard Applications/To SPEDInstab. The default name of this file obtained from ModestR is "Contribution.CSV".
FUNCTIONS
The beanplot is performed with the function beanplot of the beanplot package (Kampstra, 2008; Kampstra, 2015). The boxplot is performed with the function boxplot of graphics package.
EXAMPLE
In the example, it was estimated the relative contribution of some factors on the distribution of some freshwater species (Guisande et al., 2010; Pelayo-Villamil et al., 2015).
A beanplot or boxplot is obtained.
Garcia-Rosello, E., Guisande, C., Gonzalez-Dacosta, J., Heine, J., Pelayo-Villamil, P., Manjarres-Hernandez, A., Vaamonde, A. & Granado-Lorencio, C. (2013) ModestR: a software tool for managing and analyzing species distribution map databases. Ecography, 36, 1202-1207.
Guisande, C., Manjarres-Hernandez, A., Pelayo-Villamil, P., Granado-Lorencio, C., Riveiro, I., Acuña, A., Prieto-Piraquive, E., Janeiro, E., Matias, J.M., Patti, C., Patti, B., Mazzola, S., Jimenez, S., Duque, V. & Salmeron, F. (2010) IPez: An expert system for the taxonomic identification of fishes based on machine learning techniques. Fisheries Research, 102, 240-247.
Kampstra, P (2008). Beanplot: A Boxplot Alternative for Visual Comparison of Distributions. Journal of Statistical Software, Code Snippets, 28: 1-9.
Kampstra, P (2015) Visualization via Beanplots (like Boxplot/Stripchart/Violin Plot). R package version 1.2. Available at: https://CRAN.R-project.org/package=beanplot.
Pelayo-Villamil, P., Guisande, C., Vari, R.P., Manjarres-Hernandez, A., Garcia-Rosello, E., Gonzalez-Dacosta, J. et al. (2015) Global diversity patterns of freshwater fishes - potential victims of their own success. Diversity and Distributions, 21, 345-356.
data(FishFC) ContrBB(data=FishFC, vars=c("Altitude","Aspect","BIO1","BIO12", "BIO14","BIO15","BIO18", "BIO19","BIO2","BIO3","BIO4","BIO8","Pop","TPP","Slope","TH24","VI"), graph="boxplot")
data(FishFC) ContrBB(data=FishFC, vars=c("Altitude","Aspect","BIO1","BIO12", "BIO14","BIO15","BIO18", "BIO19","BIO2","BIO3","BIO4","BIO8","Pop","TPP","Slope","TH24","VI"), graph="boxplot")
It creates global geographic ESRI ASCII raster files with the mean relative contribution of the factors (considering all species present in the cell).
ContrMap(data, vars, Species, Level=NULL, Taxon=NULL, jpg=FALSE)
ContrMap(data, vars, Species, Level=NULL, Taxon=NULL, jpg=FALSE)
data |
Data file, which it may be obtained using DataManager of ModestR. See details section of the function ContrBB for the explanation of the format of the data. IMPORTANT: It is also necessary the ESRI ASCII raster files with the distribution of the species obtained from ModestR, which are saved by default in a folder named "Species". Therefore, the working directory must be this folder with the ESRI ASCII raster files of the distribution of the species. |
vars |
Factors. |
Species |
Variable with the name of the species. |
Level |
Optionally, a taxonomic level may be selected, i.e., class, family, order, genus or species. |
Taxon |
Optionally, it is possible to work only with a selected species, just specifying the name of the taxon or taxa selected within the taxonomic level selected in the argument Level, i.e., name of the order, family, etc. Can be a vector, so several taxa. |
jpg |
If TRUE the plots are exported to jpg files instead of using the windows device. |
FUNCTIONS
The raster file is created using the functions raster, writeRaster and setValues of the package raster (Hijmans et al., 2015).
ESRI ASCII raster files are obtained for each factor selected in the argument vars. Each raster cell is the mean relative contribution of the factor considering all species present in the cell. This raster map be displayed with MapMaker of ModestR (Garcia-Rosello et al., 2013), the function Rmap or any GIS software.
Hijmans, R.J., Etten, J. van, Cheng, J., Mattiuzzi, M., Sumner, M., Greenberg, J.A., Lamigueiro, O.P., Bevan, A., Racine, E.B., Shortridge, A., (2015) Geographic Data Analysis and Modeling. R package version 2.5-8. Available at: https://CRAN.R-project.org/package=raster.
Relative contribution of factors to explain the distribution of some freshwater fish species of the orders Amiiformes, Atheriniformes and Perciformes. The file was obtained using ModestR.
data(FishFC)
data(FishFC)
An data frame with 22 columns: taxonomic data (order, family, genus and species) and the contribution of 17 factors.
The records of the species and some environmental variables such as altitude, aspect, slope, topographic heterogeneity (TH24), terrestrial primary production (TPP), vegetation index (VI) and population density (Pop) were obtained from Guisande et al. (2010) and Pelayo-Villamil et al. (2015). The variables mean annual temperature (BIO1), temperature diurnal range (BIO2), isothermality (BIO3), temperature seasonality (BIO4), mean temperature of wettest quarter (BIO8), annual precipitation (BIO12), precipitation of driest month (BIO14), precipitation seasonality (BIO15), precipitation of warmest quarter (BIO18) and precipitation of coldest quarter (BIO19) were downloaded from the web https://www.worldclim.org/.
Guisande, C., Manjarres-Hernandez, A., Pelayo-Villamil, P., Granado-Lorencio, C., Riveiro, I., Acuña, A., Prieto-Piraquive, E., Janeiro, E., Matias, J.M., Patti, C., Patti, B., Mazzola, S., Jimenez, S., Duque, V. & Salmeron, F. (2010) IPez: An expert system for the taxonomic identification of fishes based on machine learning techniques. Fisheries Research, 102, 240-247.
Hijmans, R.J., Cameron, S.E., Parra, J.L., Jones, P.G. and Jarvis, A. (2005) Very high resolution interpolated climate surfaces for global land areas. International Journal of Climatology, 25, 1965-1978.
Pelayo-Villamil, P., Guisande, C., Vari, R.P., Manjarres-Hernandez, A., Garcia-Rosello, E., Gonzalez-Dacosta, J. et al. (2015) Global diversity patterns of freshwater fishes - potential victims of their own success. Diversity and Distributions, 21, 345-356.
Instability index of some freshwater fish species of the orders Amiiformes and Perciformes. The file was obtained using ModestR (Pelayo-Villamil et al., 2012; Garcia-Roselló et al., 2013).
data(Instability)
data(Instability)
An data frame with 15 columns: taxonomic data (order, family, genus and species), variable, number of interval, value of the interval, frequencies of the cells of presence and the extent, frequencies standardized to 0-1 for both the cells of presence and the extent, instability, instability standardized to 0-1 and the contribution of the factor in percentage.
As mentioned in FishFC.
It performs a plot comparing the mean and standard deviation of the frequencies between the cells of presence and the cells of the extent.
PreExt(data, var, envar, Interval, Interval.Value, Pre, Extent, Level=NULL, Taxon=NULL, ResetPAR=TRUE, PAR=NULL, PLOT=NULL, XLAB=NULL, YLAB="Frequency", MAIN=NULL, COLOR=c("#00FF0032","#FF000032"), XLIM=NULL, YLIM=NULL, TYPE="l", LTY=c(1,2), PCH=NULL, LEGEND=NULL, AXIS=NULL, MTEXT= NULL, TEXT=NULL)
PreExt(data, var, envar, Interval, Interval.Value, Pre, Extent, Level=NULL, Taxon=NULL, ResetPAR=TRUE, PAR=NULL, PLOT=NULL, XLAB=NULL, YLAB="Frequency", MAIN=NULL, COLOR=c("#00FF0032","#FF000032"), XLIM=NULL, YLIM=NULL, TYPE="l", LTY=c(1,2), PCH=NULL, LEGEND=NULL, AXIS=NULL, MTEXT= NULL, TEXT=NULL)
data |
Data file, which it may be obtained using DataManager of ModestR. See details section for the explanation of the format of the data. |
var |
Variable with the names of the factors. |
envar |
Factor. |
Interval |
Variable with the intervals. |
Interval.Value |
Variable with the values of the intervals. |
Pre |
Values of intervals for the presences. |
Extent |
Values of intervals for the extent. |
Level |
Optionally, a taxonomic level may be selected, i.e., class, family, order, genus or species. |
Taxon |
Optionally, it is possible to work only with a selected species, just specifying the name of the taxon or taxa selected within the taxonomic level selected in the argument Level, i.e., name of the order, family, etc. Can be a vector, so several taxa. |
ResetPAR |
If it is FALSE, the default condition of the function PAR is not placed and maintained those defined by the user in previous graphics. |
PAR |
It accesses the function PAR, allowing to modify different aspects of the graph. |
PLOT |
It allows to specify the characteristics of the function plot.default. |
XLAB |
Legend of X axis. |
YLAB |
Legend of Y axis. |
MAIN |
Main title of the plot. Default is the name of the environmental factor selected in the argument envar. |
COLOR |
Vector with the color of the presences and absences. |
XLIM |
Vector with the limits of the X axis. |
YLIM |
Vector with the limits of the Y axis. |
TYPE |
Type of plot. The following values are possible: "p" for points, "l" for lines, "b" for both points and lines, "c" for empty points joined by lines, "o" for overplotted points and lines, "s" and "S" for stair steps and "h" for histogram-like vertical lines. Finally, "n" does not produce any points or lines. |
LTY |
The line type. Line types can either be specified as an integer (0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash) or as one of the character strings "blank", "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash", where "blank" uses invisible lines (i.e., does not draw them). |
PCH |
Graphic symbol. |
LEGEND |
It allows to include a legend to the graph. |
AXIS |
It allows to add axes to the graph. |
MTEXT |
It allows to add text on the margins of the graph. |
TEXT |
It allows to add text in any area of the inner part of the graph. |
The CSV file required in the argument data has the following format: class, order, family, genus and species, along with the frequencies for presence and for the extent. This file may be obtained using ModestR (Garcia-Rosello et al., 2013; available at the web site using the following menu: Export checked maps/To RWizard Applications/To SPEDInstab. The default name of this file obtained from ModestR is "Instability.CSV".
FUNCTIONS
The plot is performed with the function plot.default of base graphics package
EXAMPLE
In the example, it was estimated the instability index for several species of the orders Amiiformes and Perciformes (Guisande et al., 2010; Pelayo-Villamil et al., 2015). It is shown the percentiles of the variable altitude for presence and the extent.
A plot is obtained.
Garcia-Rosello, E., Guisande, C., Gonzalez-Dacosta, J., Heine, J., Pelayo-Villamil, P., Manjarres-Hernandez, A., Vaamonde, A. & Granado-Lorencio, C. (2013) ModestR: a software tool for managing and analyzing species distribution map databases. Ecography, 36, 1202-1207.
Guisande, C., Manjarres-Hernandez, A., Pelayo-Villamil, P., Granado-Lorencio, C., Riveiro, I., Acuña, A., Prieto-Piraquive, E., Janeiro, E., Matias, J.M., Patti, C., Patti, B., Mazzola, S., Jimenez, S., Duque, V. & Salmeron, F. (2010) IPez: An expert system for the taxonomic identification of fishes based on machine learning techniques. Fisheries Research, 102, 240-247.
Pelayo-Villamil, P., Guisande, C., Vari, R.P., Manjarres-Hernandez, A., Garcia-Rosello, E., Gonzalez-Dacosta, J. et al. (2015) Global diversity patterns of freshwater fishes - potential victims of their own success. Diversity and Distributions, 21, 345-356.
data(Instability) PreExt(data=Instability, var="Variable", envar="Altitude", Interval="Interval", Interval.Value="Interval.Value", Pre="Presence.Prop", Extent="Extent.Prop", XLAB="Altitude (m)")
data(Instability) PreExt(data=Instability, var="Variable", envar="Altitude", Interval="Interval", Interval.Value="Interval.Value", Pre="Presence.Prop", Extent="Extent.Prop", XLAB="Altitude (m)")
Enables mapping of administrative areas with high resolution and raster maps of environmental variables, biogeographic indexes, species richness, etc.
Rmap(data, Area="World", minLon, maxLon, minLat, maxLat, colbg="#FFFFFF", colcon="#C8C8C8", colf="black", pro=TRUE, inc=0.005, exclude=NULL, colexc=NULL, colfexc="black", colscale=c("#C8FFFFFF", "#64FFFFFF", "#00FFFFFF", "#64FF64FF", "#C8FF00FF", "#FFFF00FF", "#FFC800FF", "#FF6400FF","#FF0000FF"), legend.pos="y", breaks=10, xl=0, xr=0, yb=0, yt=0, asp, lab=NULL, xlab="Longitude", ylab="Latitude", main=NULL, cex.main=1.2, cex.lab=1, cex.axis=0.9, cex.legend=0.9, family="sans", font.main=2, font.lab=1, font.axis=1, lwdP=0.6, lwdC=0.1, trans=c(1,1), log=c(0,0), ndigits=0, ini=NULL, end=NULL, jpg=FALSE, filejpg="Map.jpg")
Rmap(data, Area="World", minLon, maxLon, minLat, maxLat, colbg="#FFFFFF", colcon="#C8C8C8", colf="black", pro=TRUE, inc=0.005, exclude=NULL, colexc=NULL, colfexc="black", colscale=c("#C8FFFFFF", "#64FFFFFF", "#00FFFFFF", "#64FF64FF", "#C8FF00FF", "#FFFF00FF", "#FFC800FF", "#FF6400FF","#FF0000FF"), legend.pos="y", breaks=10, xl=0, xr=0, yb=0, yt=0, asp, lab=NULL, xlab="Longitude", ylab="Latitude", main=NULL, cex.main=1.2, cex.lab=1, cex.axis=0.9, cex.legend=0.9, family="sans", font.main=2, font.lab=1, font.axis=1, lwdP=0.6, lwdC=0.1, trans=c(1,1), log=c(0,0), ndigits=0, ini=NULL, end=NULL, jpg=FALSE, filejpg="Map.jpg")
data |
A matrix (see details section) or an ESRI ASCII raster file with the environmental variable, data of richness, etc. |
Area |
Only if using RWizard. A character with the name of the administrative area or a vector with several administrative areas (countries, regions, etc.) or river basins. If it is "World" (default) the entire world is plotted. For using administrative areas or river basins, in addition to use RWizard, it is also necessary to replace data(world) by @_Build_AdWorld_ (see example 2). |
minLon , maxLon
|
Optionally it is possible to define the minimum and maximum longitude. |
minLat , maxLat
|
Optionally it is possible to define the minimum and maximum latitude. |
colbg |
Background color of the map (in some cases this is the sea). |
colcon |
Background color of the administrative areas. |
colf |
Color of administrative areas border. |
pro |
If it is TRUE an automatic calculation is made in order to correct the aspect ratio y/x along latitude. |
inc |
Adds some room along the map margins with the limits x and y thus not exactly the limits of the selected areas. |
exclude |
A character with the name of the administrative area or a vector with several administrative areas that may be plotted with a different color on the map (only if using RWizard). |
colexc |
Background color of areas selected in the argument exclude. |
colfexc |
Color of borders of the areas selected in the argument exclude. |
colscale |
Palette color. |
legend.pos |
Whether to have a horizontal "x" or vertical "y" color scale. |
breaks |
Number of breakpoints of the color legend. |
xl , xr , yb , yt
|
The lower left and upper right coordinates of the color legend in user coordinates. |
asp |
The y/x aspect ratio. |
lab |
A numerical vector of the form c(x, y) which modifies the default way that axes are annotated. The values of x and y give the (approximate) number of tickmarks on the x and y axes. |
xlab |
A title for the X axis. |
ylab |
A title for the Y axis. |
main |
An overall title for the plot. |
cex.main |
The magnification to be used for main titles relative to the current setting of cex. |
cex.lab |
The magnification to be used for X and Y labels relative to the current setting of cex. |
cex.axis |
The magnification to be used for axis annotation relative to the current setting of cex. |
cex.legend |
The magnification to be used for the color scale relative to the current setting of cex. |
family |
The name of a font family for drawing text. |
font.main |
The font to be used for plot main titles. |
font.lab |
The font to be used for x and y labels. |
font.axis |
The font to be used for axis annotation. |
lwdP |
Line width of the plot. |
lwdC |
Line width of the borders. |
trans |
It is possible to multiply or divide the dataset by a value. For a vector with two values, the first may be 0 (divide) or 1 (multiply), and the second number is the value of the division or multiplication. |
log |
It is possible to apply a logarithmic transformation to the dataset. For a vector with two values, the first may be 0 (do not log transform) or 1 (log transformation), and the second number is the value to be added in case of log transformation. |
ndigits |
Number of decimals in legend of the color scale. |
ini |
Minimum to be considered in the color scale. |
end |
Maximum to be considered in the color scale. |
jpg |
If TRUE the plots are exported to jpg files instead of using the windows device. |
filejpg |
Name of the jpg file. |
The matrix required in the argument data may be obtained using ModestR: Export/Export checked maps/To RWizard Applications/To MapsR. It is also possible to use an ESRI ASCII raster file obtained with the function ContrMap or with any other software.
FUNCTIONS
The function color.legend of the package plotrix (Lemon et al., 2014) is used for building the map.
EXAMPLE
Example 1. An ESRI ASCII raster file obtained with the function ContrMap is used to obtain the map displayed below, which is the mean contribution to explain species distribution of some freshwater fish species, in cells of 1 degree, of the variable vegetation index.
A map is obtained.
Lemon, J. (2006) Plotrix: a package in the red light district of R. R-News, 6(4):8-12.
Lemon, J., Bolker, B., Oom, S., Klein, E., Rowlingson, B., Wickham, H., Tyagi, A., Eterradossi, O., Grothendieck, G., Toews, M., Kane, J., Turner, R., Witthoft, C., Stander, J., Petzoldt, T., Duursma, R., Biancotto, E., Levy, O., Dutang, C., Solymos, P., Engelmann, R., Hecker, M., Steinbeck, F., Borchers, H., Singmann, H., Toal, T. & Ogle, D. (2015). Various plotting functions. R package version 3.6-1. Available at: https://CRAN.R-project.org/package=plotrix.
## Not run: #Example 1 #If using RWizard, for a better quality of the geographic #coordinates, replace data(adworld) by @_Build_AdWorld_ data(adworld) data(VI) Rmap(data=VI, colscale=rev(heat.colors(100)), main= "Percentage of contribution of vegetation index") #Example 2. Only to be used with RWizard and the map is exported to a jpg data(VI) @_Build_AdWorld_ Rmap(data = VI , Area = c("Argentina", "Bolivia", "Brazil", "Chile", "Colombia", "Ecuador", "French Guiana", "Guyana", "Paraguay", "Peru", "Suriname", "Uruguay", "Venezuela","Panama","Nicaragua","Costa Rica"), main = "Percentage of contribution of vegetation index", jpg=TRUE) ## End(Not run)
## Not run: #Example 1 #If using RWizard, for a better quality of the geographic #coordinates, replace data(adworld) by @_Build_AdWorld_ data(adworld) data(VI) Rmap(data=VI, colscale=rev(heat.colors(100)), main= "Percentage of contribution of vegetation index") #Example 2. Only to be used with RWizard and the map is exported to a jpg data(VI) @_Build_AdWorld_ Rmap(data = VI , Area = c("Argentina", "Bolivia", "Brazil", "Chile", "Colombia", "Ecuador", "French Guiana", "Guyana", "Paraguay", "Peru", "Suriname", "Uruguay", "Venezuela","Panama","Nicaragua","Costa Rica"), main = "Percentage of contribution of vegetation index", jpg=TRUE) ## End(Not run)
Relative contribution of vegetation index to explain species distribution of freshwater fish species, in cells of 1 degree around the world.
data(VI)
data(VI)
A matrix with 180 rows (latitudes) and 360 columns (longitudes).