-
Notifications
You must be signed in to change notification settings - Fork 16
/
README.Rmd
119 lines (89 loc) · 4.65 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
output:
github_document:
html_preview: false
---
<!-- badges: start -->
[![R-CMD-check](https://github.com/ropensci/landscapetools/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/landscapetools/actions)
[![codecov](https://codecov.io/gh/ropensci/landscapetools/branch/develop/graph/badge.svg)](https://codecov.io/gh/ropensci/landscapetools)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![CRAN status](https://www.r-pkg.org/badges/version/landscapetools)](https://cran.r-project.org/package=landscapetools)
[![](http://cranlogs.r-pkg.org/badges/grand-total/landscapetools)](http://cran.rstudio.com/web/packages/landscapetools/index.html)
[![](https://badges.ropensci.org/188_status.svg)](https://github.com/ropensci/onboarding/issues/188)
[![DOI:10.1111/2041-210X.13076](https://zenodo.org/badge/DOI/10.1111/2041-210X.13076.svg)](https://doi.org/10.1111/2041-210X.13076)
<!-- badges: end -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# 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.
- `show_shareplot`: Plot the landscape share in subsequential buffers around a/multiple point(s) of interest
#### 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:
```r
install.packages("landscapetools")
```
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("ropensci/landscapetools")
```
## Utilities
```{r load_libraries_hidden, eval=TRUE, echo=FALSE, message=FALSE, results='hide'}
library(landscapetools)
```
### Classify
```{r fig.retina=2, message=FALSE}
# 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
```{r fig.retina=2, message=FALSE}
# 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](https://github.com/ropensci/NLMR/) package.
## Meta
* Please [report any issues or bugs](https://github.com/ropensci/landscapetools/issues/new/).
* 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](CONTRIBUTING.md).
* Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
[![ropensci_footer](https://ropensci.org/public_images/github_footer.png)](http://ropensci.org)