Skip to content

Commit

Permalink
Merge pull request #23 from b-cubed-eu/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
mmyahaya authored Dec 31, 2024
2 parents 759c544 + 63c6b17 commit a6d1966
Show file tree
Hide file tree
Showing 26 changed files with 163 additions and 153 deletions.
15 changes: 7 additions & 8 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' GBIF occurrences data of acacia in South Africa
#' An example of occurrence data from GBIF containing required column for impact indicator.
#'
#' @format A dataframe object containing 17,279 rows and 6 variables
#' @format A dataframe object containing 19,100 rows and 6 variables
#' \describe{
#' \item{decimalLatitude}{geographic latitude in decimal}
#' \item{decimalLongitude}{geographic longitude in decimal}
Expand All @@ -13,7 +13,7 @@
#' @examples
#' head(taxa_Acacia,10)
#'
#' @source \url{https://www.gbif.org/occurrence/search?country=ZA&taxon_key=2978223&occurrence_status=present}
#' @source \url{https://doi.org/10.15468/dl.b6gda5}
"taxa_Acacia"


Expand All @@ -33,18 +33,17 @@



#' GBIF occurrences data of acacia in South Africa
#' An example of occurrence data from GBIF containing required column for impact indicator.
#' EICAT data of acacia taxa
#' An example of EICAT data containing species name, impact category and mechanism.
#'
#' @format A dataframe object containing 138 observations and 4 variables
#' @format A dataframe object containing 138 observations and 3 variables
#' \describe{
#' \item{scientific_name}{species scientific name}
#' \item{impact_category}{EICAT impact category}
#' \item{impact_mechanism}{mecahnism of impact}
#' \item{probability}{weight of impact}
#' }
#' @examples
#' head(eicat_data,10)
#' head(eicat_acacia,10)
#'
#' @source \url{https://github.com/Oceane-Boulesnane-Guengant/Risk_maps_Acacia_SA/tree/main/data}
"eicat_data"
"eicat_acacia"
4 changes: 1 addition & 3 deletions R/impact_category.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#' @export
#'
#' @examples
#' # read the impact data
#' # eicat_data<-readRDS("data/eicat_data.rds")
#' # define species list
#' species_list <- c(
#' "Acacia adunca",
Expand All @@ -38,7 +36,7 @@
#' )
#'
#' agg_impact <- impact_cat(
#' impact_data = eicat_data,
#' impact_data = eicat_acacia,
#' species_list = species_list,
#' col_category = "impact_category",
#' col_species = "scientific_name",
Expand Down
2 changes: 1 addition & 1 deletion R/impact_indicator.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#' )
#' impact_value <- impact_indicator(
#' cube = acacia_cube,
#' impact_data = eicat_data,
#' impact_data = eicat_acacia,
#' col_category = "impact_category",
#' col_species = "scientific_name",
#' col_mechanism = "impact_mechanism",
Expand Down
6 changes: 3 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' # compute impact indicator
#' impact_value <- impact_indicator(
#' cube = acacia_cube,
#' impact_data = eicat_data,
#' impact_data = eicat_acacia,
#' col_category = "impact_category",
#' col_species = "scientific_name",
#' col_mechanism = "impact_mechanism",
Expand Down Expand Up @@ -96,7 +96,7 @@ plot.impact_indicator <- function(x,
#' # compute species impact
#' speciesImpact <- species_impact(
#' cube = acacia_cube,
#' impact_data = eicat_data,
#' impact_data = eicat_acacia,
#' col_category = "impact_category",
#' col_species = "scientific_name",
#' col_mechanism = "impact_mechanism",
Expand Down Expand Up @@ -187,7 +187,7 @@ plot.species_impact <- function(x,
#' # compute site impact
#' siteImpact <- site_impact(
#' cube = acacia_cube,
#' impact_data = eicat_data,
#' impact_data = eicat_acacia,
#' col_category = "impact_category",
#' col_species = "scientific_name",
#' col_mechanism = "impact_mechanism",
Expand Down
2 changes: 1 addition & 1 deletion R/site_impact.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#'
#' siteImpact <- site_impact(
#' cube = acacia_cube,
#' impact_data = eicat_data,
#' impact_data = eicat_acacia,
#' col_category = "impact_category",
#' col_species = "scientific_name",
#' col_mechanism = "impact_mechanism",
Expand Down
2 changes: 1 addition & 1 deletion R/species_impact.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#'
#' speciesImpact <- species_impact(
#' cube = acacia_cube,
#' impact_data = eicat_data,
#' impact_data = eicat_acacia,
#' col_category = "impact_category",
#' col_species = "scientific_name",
#' col_mechanism = "impact_mechanism",
Expand Down
23 changes: 13 additions & 10 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ knitr::opts_chunk$set(
<!-- badges: start -->
[![R-CMD-check](https://github.com/b-cubed-eu/impIndicator/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/b-cubed-eu/impIndicator/actions/workflows/R-CMD-check.yaml)
[![repo status](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![CRAN status](https://www.r-pkg.org/badges/version/impIndicator)](https://CRAN.R-project.org/package=impIndicator)
<!-- badges: end -->

The goal of **impIndicator** is to allow users to seamlessly calculate and visualise the impact of alien taxa and individual species in a given area. It calculates and visualises impact per site as a map. It takes in GBIF occurrence data and EICAT assessment list. It enables users to choose from various methods
The goal of **impIndicator** is to allow users to seamlessly calculate and visualise the impact of alien taxa and individual species in a given area. It calculates and visualises impact per site as a map. It takes in GBIF occurrence data and EICAT assessment data. It enables users to choose from various methods
of calculating impact indicators based on different studies.\

The impIndicator produces three main products and can be useful as stated below:\
Expand Down Expand Up @@ -59,8 +60,9 @@ library(sf) # Spatial features


## Process occurrence cube
The Global Biodiversity Information Facility (GBIF) occurrence data is a standardised species information that documents the presence or absence of species at particular locations and times.
```{r}
# load the GBIF occurrence data for taxa
# Process cube from GBIF occurrence data in the R studio environment
acacia_cube <- taxa_cube(
taxa = taxa_Acacia,
Expand All @@ -72,12 +74,13 @@ acacia_cube <- taxa_cube(
acacia_cube
```

## EICAT data

## EICAT assessment data
The Environmental Impact Classification for Alien Taxa (EICAT) assessment data is the reported impact of alien taxa based on EICAT method which is the IUCN standard. An assessed alien taxa with adequate data is classified into massive (MV),
major (MR), moderate (MO), minor (MN), or minimal concern (MC) depending on the severity of the impact caused on recipient ecosystem. Additional information such as the mechanisms and location of impact are also recorded.
An example of an EICAT data is:
```{r}
# view EICAT data. Convert to tibble for a nicer display
head(as_tibble(eicat_data),10)
# view EICAT data
head(eicat_acacia,10)
```

## Compute impact map
Expand All @@ -89,7 +92,7 @@ indicators, namely, **precautionary**, **precautionary cumulative**, **mean**, *
```{r}
siteImpact <- site_impact(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand All @@ -112,7 +115,7 @@ To compute the impact indicator of alien taxa, we sum all the yearly impact scor
impactIndicator <- impact_indicator(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand All @@ -131,7 +134,7 @@ We compute the impact indicator per species by summing the impact risk map per s
species_value <- species_impact(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand Down Expand Up @@ -162,7 +165,7 @@ all_impact <- data.frame("year" = unique(acacia_cube$data$year))
for (type in types) {
impact_value <- impact_indicator(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand Down
81 changes: 47 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
[![R-CMD-check](https://github.com/b-cubed-eu/impIndicator/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/b-cubed-eu/impIndicator/actions/workflows/R-CMD-check.yaml)
[![repo
status](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![CRAN
status](https://www.r-pkg.org/badges/version/impIndicator)](https://CRAN.R-project.org/package=impIndicator)
<!-- badges: end -->

The goal of **impIndicator** is to allow users to seamlessly calculate
and visualise the impact of alien taxa and individual species in a given
area. It calculates and visualises impact per site as a map. It takes in
GBIF occurrence data and EICAT assessment list. It enables users to
GBIF occurrence data and EICAT assessment data. It enables users to
choose from various methods of calculating impact indicators based on
different studies.

Expand Down Expand Up @@ -80,8 +82,12 @@ library(sf) # Spatial features

## Process occurrence cube

The Global Biodiversity Information Facility (GBIF) occurrence data is a
standardised species information that documents the presence or absence
of species at particular locations and times.

``` r
# load the GBIF occurrence data for taxa
# Process cube from GBIF occurrence data in the R studio environment

acacia_cube <- taxa_cube(
taxa = taxa_Acacia,
Expand Down Expand Up @@ -110,42 +116,49 @@ acacia_cube
#>
#> # A tibble: 5,559 × 8
#> scientificName taxonKey minCoordinateUncerta…¹ year cellCode xcoord ycoord
#> <chr> <dbl> <dbl> <dbl> <int> <dbl> <dbl>
#> 1 Acacia implexa 2979232 1 2010 206 18.4 -33.9
#> 2 Acacia cyclops 2980425 122 2010 668 18.4 -32.2
#> 3 Acacia saligna 2978552 1 2010 206 18.4 -33.9
#> 4 Acacia pycnantha 2978604 1 2010 206 18.4 -33.9
#> 5 Acacia mearnsii 2979775 110 2010 215 20.6 -33.9
#> 6 Acacia mearnsii 2979775 1 2010 215 20.6 -33.9
#> 7 Acacia mearnsii 2979775 8 2010 1376 30.4 -29.7
#> 8 Acacia saligna 2978552 1 2011 206 18.4 -33.9
#> 9 Acacia saligna 2978552 15 2011 1312 30.9 -29.9
#> 10 Acacia mearnsii 2979775 1 2011 230 24.4 -33.9
#> <chr> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
#> 1 Acacia implexa 2979232 1 2010 206 18.4 -33.9
#> 2 Acacia cyclops 2980425 122 2010 668 18.4 -32.2
#> 3 Acacia saligna 2978552 1 2010 206 18.4 -33.9
#> 4 Acacia pycnantha 2978604 1 2010 206 18.4 -33.9
#> 5 Acacia mearnsii 2979775 110 2010 215 20.6 -33.9
#> 6 Acacia mearnsii 2979775 1 2010 215 20.6 -33.9
#> 7 Acacia mearnsii 2979775 8 2010 1376 30.4 -29.7
#> 8 Acacia saligna 2978552 1 2011 206 18.4 -33.9
#> 9 Acacia saligna 2978552 15 2011 1312 30.9 -29.9
#> 10 Acacia mearnsii 2979775 1 2011 230 24.4 -33.9
#> # ℹ 5,549 more rows
#> # ℹ abbreviated name: ¹​minCoordinateUncertaintyInMeters
#> # ℹ 1 more variable: obs <dbl>
```

## EICAT data
## EICAT assessment data

An example of an EICAT data is:
The Environmental Impact Classification for Alien Taxa (EICAT)
assessment data is the reported impact of alien taxa based on EICAT
method which is the IUCN standard. An assessed alien taxa with adequate
data is classified into massive (MV), major (MR), moderate (MO), minor
(MN), or minimal concern (MC) depending on the severity of the impact
caused on recipient ecosystem. Additional information such as the
mechanisms and location of impact are also recorded. An example of an
EICAT data is:

``` r
# view EICAT data. Convert to tibble for a nicer display
head(as_tibble(eicat_data),10)
#> # A tibble: 10 × 4
#> scientific_name impact_category impact_mechanism probability
#> <chr> <chr> <chr> <dbl>
#> 1 Acacia saligna MC (1) Competition 0
#> 2 Acacia saligna MC (12) Indirect impacts through … 0
#> 3 Acacia saligna MC (1) Competition 0
#> 4 Acacia saligna MC (1) Competition; (9) Chemical … 0
#> 5 Acacia mearnsii MC (6) Poisoning/toxicity 0
#> 6 Acacia longifolia MC (9) Chemical impact on ecosyst… 0
#> 7 Acacia dealbata MC (9) Chemical impact on ecosyst… 0
#> 8 Acacia dealbata MC (9) Chemical impact on ecosyst… 0
#> 9 Acacia saligna MC (9) Chemical impact on ecosyst… 0
#> 10 Acacia dealbata MC (12) Indirect impacts through … 0
# view EICAT data
head(eicat_acacia,10)
#> # A tibble: 10 × 3
#> scientific_name impact_category impact_mechanism
#> <chr> <chr> <chr>
#> 1 Acacia saligna MC (1) Competition
#> 2 Acacia saligna MC (12) Indirect impacts through interaction …
#> 3 Acacia saligna MC (1) Competition
#> 4 Acacia saligna MC (1) Competition; (9) Chemical impact on th…
#> 5 Acacia mearnsii MC (6) Poisoning/toxicity
#> 6 Acacia longifolia MC (9) Chemical impact on ecosystems
#> 7 Acacia dealbata MC (9) Chemical impact on ecosystems
#> 8 Acacia dealbata MC (9) Chemical impact on ecosystems
#> 9 Acacia saligna MC (9) Chemical impact on ecosystems
#> 10 Acacia dealbata MC (12) Indirect impacts through interaction …
```

## Compute impact map
Expand All @@ -163,7 +176,7 @@ cumulative** and **cumulative**.
``` r
siteImpact <- site_impact(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand Down Expand Up @@ -191,7 +204,7 @@ year.

impactIndicator <- impact_indicator(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand All @@ -214,7 +227,7 @@ map per species and correct for sampling effort by dividing by $N$.

species_value <- species_impact(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand Down Expand Up @@ -249,7 +262,7 @@ all_impact <- data.frame("year" = unique(acacia_cube$data$year))
for (type in types) {
impact_value <- impact_indicator(
cube = acacia_cube,
impact_data = eicat_data,
impact_data = eicat_acacia,
col_category = "impact_category",
col_species = "scientific_name",
col_mechanism = "impact_mechanism",
Expand Down
Binary file added data/eicat_acacia.rda
Binary file not shown.
Binary file removed data/eicat_data.rda
Binary file not shown.
Binary file modified data/taxa_Acacia.rda
Binary file not shown.
30 changes: 30 additions & 0 deletions man/eicat_acacia.Rd

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

31 changes: 0 additions & 31 deletions man/eicat_data.Rd

This file was deleted.

Loading

0 comments on commit a6d1966

Please sign in to comment.