📦 R package for some of the less-glamorous tasks involved in landscape analysis 🌏
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github codemeta and dotgithubfiles Mar 25, 2018
R fix #18 partly Feb 17, 2019
data-raw finalizing cleanup Jan 22, 2019
data
docs
inst remove roboto font Dec 5, 2018
man rebuilds readme Feb 17, 2019
src fix a couple of things Jan 29, 2019
tests
vignettes finalizing cleanup Jan 22, 2019
.Rbuildignore
.gitignore
.travis.yml fix travis and tic Feb 12, 2019
CODE_OF_CONDUCT.md
CONTRIBUTING.md
DESCRIPTION update Jan 29, 2019
LICENSE.md
NAMESPACE Deploy from Travis build 132 [ci skip] Feb 12, 2019
NEWS.md
README.Rmd adds cran installation instruction Feb 17, 2019
README.md
_pkgdown.yml finalizing cleanup Jan 22, 2019
appveyor.yml
codecov.yml some updates Mar 16, 2018
codemeta.json codemeta and dotgithubfiles Mar 25, 2018
cran-comments.md
landscapetools.Rproj ready package for cran submission Mar 26, 2018
tic.R

README.md

Travis build status Build status codecov lifecycle CRAN status DOI:10.1111/2041-210X.13076

landscapetools

landscapetools provides utility functions for some of the less-glamorous tasks involved in landscape analysis:

Utilities:

  • util_binarize: Binarize continuous raster values, if > 1 breaks are given, return a RasterBrick.
  • util_classify: Classify a raster into proportions based upon a vector of class weightings.
  • util_merge: Merge a primary raster with other rasters weighted by scaling factors.
  • util_raster2tibble, util_tibble2raster: Coerce raster* objects to tibbles and vice versa.
  • util_rescale: Linearly rescale element values in a raster to a range between 0 and 1.
  • util_writeESRI: Export raster objects as ESRI asciis (with Windows linebreaks).

Visualization

  • show_landscape: Plot a Raster* object with the landscapetools default theme (as ggplot) or multiple raster (RasterStack, -brick or list of raster) side by side as facets.

Themes:

  • theme_nlm, theme_nlm_grey: Opinionated ggplot2 theme to visualize raster (continuous data).
  • theme_nlm_discrete, theme_nlm_grey_discrete: Opinionated ggplot2 theme to visualize raster (discrete data).
  • theme_faceplot: Opinionated ggplot2 theme to visualize raster in a facet wrap.

Installation

You can install the released version from CRAN with:

install.packages("landscapetools")

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("ropensci/landscapetools")

Utilities

Binarize

# Binarize the landscape into habitat and matrix
binarized_raster <- util_binarize(fractal_landscape, breaks = 0.31)
#> Loading required package: raster
#> Loading required package: sp

show_landscape(binarized_raster)

Classify

# Classify the landscape into land uses
classified_landscape <- util_classify(fractal_landscape,
                                      n = 3,
                                      level_names = c("Land Use 1", 
                                                      "Land Use 2",
                                                      "Land Use 3"))

show_landscape(classified_landscape, discrete = TRUE)

Merge

# Merge all landscapes into one
merged_landscape <- util_merge(fractal_landscape,
                               c(gradient_landscape, random_landscape),
                               scalingfactor = 1)

# Plot an overview
merge_vis <- list(
    "1) Primary" = fractal_landscape,
    "2) Secondary 1" = gradient_landscape,
    "3) Secondary 2" = random_landscape,
    "4) Result" = merged_landscape
)

show_landscape(merge_vis)

See also

In the examples above we make heavy use of the NLMR package. Both packages were developed together until we split them into pure landscape functionality and utility tools. If you are interested in generating neutral landscapes via a multitude of available algorithms take a closer look at the NLMR package.

Meta

  • Please report any issues or bugs.
  • License: GPL3
  • Get citation information for landscapetools in R doing citation(package = 'landscapetools')
  • We are very open to contributions - if you are interested check Contributing.
    • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

ropensci_footer