MyNixOS website logo
Description

Species Distribution Modelling Predictor Datasets.

Terrestrial and marine predictors for species distribution modelling from multiple sources, including WorldClim <https://www.worldclim.org/>,, ENVIREM <https://envirem.github.io/>, Bio-ORACLE <https://bio-oracle.org/> and MARSPEC <http://www.marspec.org/>.

MIT License R-CMD-check CRAN_Status_Badge CRAN Downloads per month CRAN total downloads

sdmpredictors: a compilation of species distribution modelling predictors data

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
    devtools::install_github("lifewatch/sdmpredictors")

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
    datasets <- list_datasets(terrestrial = FALSE, marine = TRUE)
    View(datasets)
    layers <- list_layers(datasets)
    View(layers)
    # Load equal area rasters and crop with the extent of the Baltic Sea
    layercodes <- c("MS_biogeo05_dist_shore_5m", "MS_bathy_5m", 
                    "BO_sstrange", "BO_sstmean", "BO_salinity")
    env <- load_layers(layercodes, equalarea = TRUE)
    australia <- raster::crop(env, extent(106e5,154e5, -52e5, -13e5))
    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
    prettynames <- list(BO_salinity="Salinity", BO_sstmean="SST (mean)", 
                        BO_sstrange="SST (range)", MS_bathy_5m="Bathymetry",
                        MS_biogeo05_dist_shore_5m = "Shore distance")
    p1 <- plot_corr(layers_correlation(layercodes), prettynames)
    australian_correlations <- pearson_correlation_matrix(australia)
    p2 <- plot_correlation(australian_correlations, prettynames)
    cowplot::plot_grid(p1, p2, labels=c("A", "B"), ncol = 2, nrow = 1)
    print(correlation_groups(australian_correlations))
    # Fetch occurrences and prepare for ZOON
    occ <- marinespeed::get_occurrences("Dictyota diemensis")
    points <- SpatialPoints(occ[,c("longitude", "latitude")],
                            lonlatproj)
    points <- spTransform(points, equalareaproj)
    occfile <- tempfile(fileext = ".csv")
    write.csv(cbind(coordinates(points), value=1), occfile)
    # Create SDM with ZOON
    workflow(
      occurrence = LocalOccurrenceData(
        occfile, occurrenceType="presence",
        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
    datasets <- list_datasets(terrestrial = FALSE, marine = TRUE)
    View(datasets)
    browseURL(datasets$url[1])
    
    # exploring the layers
    layers <- list_layers(datasets)
    View(layers)
    
    # download specific layers to the current directory
    rasters <- load_layers(c("BO_calcite", "BO_chlomean", "MS_bathy_5m"), datadir = ".")

Example 3: looking up statistics and correlations for marine annual layers:

    datasets <- list_datasets(terrestrial = FALSE, marine = TRUE)
    layers <- list_layers(datasets)
    
    # filter out monthly layers
    layers <- layers[is.na(layers$month),]
    
    stats <- layer_stats(layers)
    View(stats)
    
    correlations <- layers_correlation(layers)
    View(correlations)
    
    # create groups of layers where no layers in one group 
    # have a correlation > 0.7 with a layer from another group
    groups <- correlation_groups(correlations, max_correlation=0.7)
    
    # inspect groups
    # heatmap plot for larger groups (if gplots library is installed)
    for(group in groups) {
      group_correlation <- as.matrix(correlations[group, group, drop=FALSE])
      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")
Metadata

Version

0.2.15

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows