The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
An R package to improve the usability of datasets with predictors for species distribution modelling (SDM).
Installation:
install.packages("sdmpredictors")
# or for the latest dev version
::install_github("lifewatch/sdmpredictors") devtools
Example 1: Create SDM for Dictyota diemensis in Australia Note that this requires the ZOON, ggplot2, cowplot and marinespeed packages to be installed.
library(sdmpredictors)
library(zoon)
# Inspect the available datasets and layers
<- list_datasets(terrestrial = FALSE, marine = TRUE)
datasets View(datasets)
<- list_layers(datasets)
layers View(layers)
# Load equal area rasters and crop with the extent of the Baltic Sea
<- c("MS_biogeo05_dist_shore_5m", "MS_bathy_5m",
layercodes "BO_sstrange", "BO_sstmean", "BO_salinity")
<- load_layers(layercodes, equalarea = TRUE)
env <- raster::crop(env, extent(106e5,154e5, -52e5, -13e5))
australia plot(australia)
# Compare statistics between the original and the Australian bathymetry
View(rbind(layer_stats("MS_bathy_5m"),
calculate_statistics("Bathymetry Australia",
raster(australia, layer = 2))))
# Compare correlations between predictors, globally and for Australia
<- list(BO_salinity="Salinity", BO_sstmean="SST (mean)",
prettynames BO_sstrange="SST (range)", MS_bathy_5m="Bathymetry",
MS_biogeo05_dist_shore_5m = "Shore distance")
<- plot_corr(layers_correlation(layercodes), prettynames)
p1 <- pearson_correlation_matrix(australia)
australian_correlations <- plot_correlation(australian_correlations, prettynames)
p2 ::plot_grid(p1, p2, labels=c("A", "B"), ncol = 2, nrow = 1)
cowplotprint(correlation_groups(australian_correlations))
# Fetch occurrences and prepare for ZOON
<- marinespeed::get_occurrences("Dictyota diemensis")
occ <- SpatialPoints(occ[,c("longitude", "latitude")],
points
lonlatproj)<- spTransform(points, equalareaproj)
points <- tempfile(fileext = ".csv")
occfile write.csv(cbind(coordinates(points), value=1), occfile)
# Create SDM with ZOON
workflow(
occurrence = LocalOccurrenceData(
occurrenceType="presence",
occfile, columns = c("longitude", "latitude", "value")),
covariate = LocalRaster(stack(australia)),
process = OneHundredBackground(seed = 42),
model = LogisticRegression,
output = PrintMap)
# Layer citations
print(layer_citations(layercodes))
Example 2: view marine datasets, layers and load a few of them by name
library(sdmpredictors)
# exploring the marine datasets
<- list_datasets(terrestrial = FALSE, marine = TRUE)
datasets View(datasets)
browseURL(datasets$url[1])
# exploring the layers
<- list_layers(datasets)
layers View(layers)
# download specific layers to the current directory
<- load_layers(c("BO_calcite", "BO_chlomean", "MS_bathy_5m"), datadir = ".") rasters
Example 3: looking up statistics and correlations for marine annual layers:
<- list_datasets(terrestrial = FALSE, marine = TRUE)
datasets <- list_layers(datasets)
layers
# filter out monthly layers
<- layers[is.na(layers$month),]
layers
<- layer_stats(layers)
stats View(stats)
<- layers_correlation(layers)
correlations View(correlations)
# create groups of layers where no layers in one group
# have a correlation > 0.7 with a layer from another group
<- correlation_groups(correlations, max_correlation=0.7)
groups
# inspect groups
# heatmap plot for larger groups (if gplots library is installed)
for(group in groups) {
<- as.matrix(correlations[group, group, drop=FALSE])
group_correlation if(require(gplots) && length(group) > 4){
heatmap.2(abs(group_correlation)
main = "Correlation"
,col = "rainbow"
,notecol="black" # change font color of cell labels to black
,density.info="none" # turns off density plot inside color legend
,trace="none" # turns off trace lines inside the heat map
,margins = c(12,9) # widens margins around plot
,
)else {
} print(group_correlation)
} }
See the quickstart vignette for more information
vignette("quickstart", package = "sdmpredictors")
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.