-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
132 lines (91 loc) · 4.33 KB
/
README.Rmd
File metadata and controls
132 lines (91 loc) · 4.33 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
out.width = "100%")
```
rcea <img src="man/figures/package-sticker.png" align="right" style="float:right; height:120px;"/>
=========================================================
<!-- badges: start -->
[](https://github.com/david-beauchesne/rcea/actions/workflows/R-CMD-check.yaml)
[](https://github.com/david-beauchesne/rcea/actions/workflows/pkgdown.yaml)
[](https://github.com/david-beauchesne/rcea/actions/workflows/test-coverage.yaml)
[](https://codecov.io/gh/david-beauchesne/rcea)
[](https://CRAN.R-project.org/package=rcea)
[](https://choosealicense.com/licenses/gpl-2.0/)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://www.repostatus.org/#concept)
[](#)
<!-- badges: end -->
The goal of the R package `rcea` is to **{{ PLEASE ADD A FEW LINES }}**
## Installation
You can install the development version from [GitHub](https://github.com/) with:
```{r eval = FALSE}
# install.packages("remotes")
remotes::install_github("david-beauchesne/rcea")
```
Then you can attach the package `rcea`:
```{r eval = FALSE}
library("rcea")
```
## Overview
```{r}
library(rcea)
library(stars)
# Data
drivers <- rcea:::drivers
vc <- rcea:::vc
sensitivity <- rcea:::sensitivity
metaweb <- rcea:::metaweb
trophic_sensitivity <- rcea::trophic_sensitivity
pal <- viridis::viridis
# Plots
plot(merge(drivers), col = pal)
plot(merge(vc), col = pal(1))
# Cumulative footprint
foot_dr <- cea_extract(drivers, cumul_fun = "footprint")
foot_vc <- cea_extract(vc, cumul_fun = "footprint")
plot(foot_dr, col = pal)
plot(foot_vc, breaks = "equal", col = pal)
# Cumulative exposure
expo <- exposure(drivers, vc, "stars")
# Extract specific attributes and evaluate cumulative exposure
dr_sel <- c("driver1","driver5")
vc_sel <- c("vc4","vc7","vc10","vc12")
dat <- cea_extract(expo, dr_sel = dr_sel, vc_sel = vc_sel)
plot(dat["vc4"], col = pal) # Exposure of vc4 to driver1 and driver5
# Cumulative effects assessment (Halpern et al. 2008)
halpern <- cea(drivers, vc, sensitivity, "stars")
# Cumulative effects of all drivers on all vc
dat <- cea_extract(halpern, cumul_fun = "drivers")
plot(merge(dat), breaks = "equal", col = pal)
# Cumulative effects of all drivers on each vc
dat <- cea_extract(halpern, cumul_fun = "vc")
plot(merge(dat), breaks = "equal", col = pal)
# Full cumulative effects
dat <- cea_extract(dat, cumul_fun = "full")
plot(dat, breaks = "equal", col = pal)
# Network-scale cumulative effects assessment (Beauchesne et al. 2021)
beauchesne <- ncea(drivers, vc, sensitivity, metaweb, trophic_sensitivity)
# Net cumulative effects
dat <- cea_extract(beauchesne$net, cumul_fun = "full")
plot(dat, breaks = "equal", col = pal)
# Direct cumulative effects
dat <- cea_extract(beauchesne$direct, cumul_fun = "full")
plot(dat, breaks = "equal", col = pal)
# Indirect cumulative effects
dat <- cea_extract(beauchesne$indirect, cumul_fun = "full")
plot(dat, breaks = "equal", col = pal)
```
## Citation
Please cite this package as:
> Beauchesne David (`r format(Sys.Date(), "%Y")`) rcea: An R
package to perform cumulative effects assessments. R package version 0.0.0.9000.
## Code of Conduct
Please note that the `rcea` project is released with a
[Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.