Skip to content

Commit

Permalink
add trophic sensitivity and adjust cumul
Browse files Browse the repository at this point in the history
  • Loading branch information
david-beauchesne committed Apr 12, 2023
1 parent a5b0759 commit 72d08a5
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Imports:
motifcensus
motifcensus,
stars
Suggests:
knitr,
rmarkdown,
Expand Down
11 changes: 8 additions & 3 deletions R/cumul.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
#' @export
cumul <- function(dat) {
library(stars)
do.call("c", dat) |>
stars::st_redimension() |>
stars::st_apply(c(1,2), sum, na.rm = TRUE)

# Combine if in list
if (class(dat) == "list") dat <- do.call("c", dat)

# Redimension and sum
stars::st_redimension(dat) |>
stars::st_apply(c(1,2), sum, na.rm = TRUE) |>
setNames("Footprint")
}
20 changes: 20 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#' Trophic sensitivity
#'
#' A dataset containing the simplified values for trophic sensitivity as measured by Beauchesne et al. 2021 (DOI: 10.1111/ele.13841) and used by Beauchesne et al. 2020 for network-scale cumulative effects assessments
#'
#' @format ## `trophic_sensitivity`
#' A data frame with 124 rows and 10 columns:
#' \describe{
#' \item{Motif}{Name of motifs: apparent competition (ap); disconnected (di); exploitative competition (ex); omnivory (om); partially connected (pa); tri-trophic interaction (tt)}
#' \item{Species}{Position of species in motif (x,y,z)}
#' \item{px, py, pz}{Pathways of effects, whether species x, y or z are affected by disturbances}
#' \item{Sensitivity}{Trophic sensitivity scaled between 0 and 1}
#' \item{sensitivity_original}{Original value of trophic sensitivity}
#' \item{pathID}{Unique identifier of pathway of effect}
#' \item{speciesID}{Numeric ID for species position in motifs}
#' \item{motifID}{Numeric ID for motifs}
#' }
#' @source <https://github.com/david-beauchesne/FoodWeb-MultiStressors/blob/master/Data/vulnerability.RData>
#' @source <https://onlinelibrary.wiley.com/doi/abs/10.1111/ele.13841>
#' @source <https://semaphore.uqar.ca/id/eprint/1922/1/David_Beauchesne_decembre2020.pdf>
"trophic_sensitivity"
Binary file added data/TrophicSensitivity.RData
Binary file not shown.
2 changes: 1 addition & 1 deletion man/direct_cea.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions man/trophic_sensitivity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 72d08a5

Please sign in to comment.