Skip to content

njtierney/sdmtools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdmtools

Licence



sdmtools is a set of helper functions to facilitate species distribution modelling.

Installation

You can install the development version of sdmtools from GitHub with:

# install.packages("remotes")
remotes::install_github("geryan/sdmtools")

Data

library(sdmtools)

raster_to_terra an annotated equivalence table of functions from the raster and terra packages

raster_to_terra
#>           raster       terra
#> 1          brick           c
#> 2      cellStats      global
#> 3           crop        crop
#> 4   disaggregate      disagg
#> 5        extract     extract
#> 6      getValues   as.vector
#> 7           plot        plot
#> 8         raster        rast
#> 9  rasterFromXYZ        rast
#> 10      resample    resample
#> 11         stack           c
#> 12   writeRaster writeRaster
#>                                                   comment
#> 1                                                    <NA>
#> 2                            global returns df not vector
#> 3                                                    <NA>
#> 4                                                    <NA>
#> 5            cellnumbers in raster becomes cells in terra
#> 6                                                    <NA>
#> 7           maxpixels in raster becomes maxcells in terra
#> 8                                                    <NA>
#> 9  with arg `type = xyz`; where xyx is a string in quotes
#> 10                                                   <NA>
#> 11                                                   <NA>
#> 12            need to specify file type (suffix) in terra

r an example spatRaster

r
plot(r)

v an example spatVector

v
plot(v)

Function examples

source_R — source all R files in a target directory

source_R("/Users/frankenstein/project/R")

predict_sdm — made a spatial prediction from a species distribution model and covariate layers

m <- glm(z ~ cov1, cov2, data = sdm_data)

prediction <- predict_sdm(m, covs)

import_rasts — Import all rasters from a directory into a single object

rasters <- import_rasts("/data/grids/covariates")

rastpointplot — plot a raster with points over it

rastpointplot(r,v)

extract_covariates — extract covariate values from spatRaster or raster layers for a given set of points

# example

About

Helper functions for modelling species distributions

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • R 100.0%