plot.invacost.costsummary: Plot raw cumulated cost of invasive species over different...

View source: R/genericfunctions.R

plot.invacost.costsummaryR Documentation

Plot raw cumulated cost of invasive species over different periods of time

Description

This function provides different plotting methods for the raw average annual cost of invasive species over different periods of time

Usage

## S3 method for class 'invacost.costsummary'
plot(
  x,
  plot.breaks = 10^(-15:15),
  plot.type = "points",
  average.annual.values = TRUE,
  cost.transf = "log10",
  graphical.parameters = NULL,
  ...
)

Arguments

x

The output object from summarizeCosts

plot.breaks

a vector of numeric values indicating the plot breaks for the Y axis (cost values)

plot.type

"points" or "bars". Defines the type of plot you want to make; bars are not advised in log scale because the base value (0) is infinite in log-scale.

average.annual.values

if TRUE, the plot will represent average annual values rather than cumulative values over the entire period

cost.transf

Type of transformation you want to apply on cost values. Specify NULL to avoid any transformation. Only useful for graphical representation.

graphical.parameters

set this to "manual" if you want to customise ggplot2 parameters. By default, the following layers are configured: ylab, xlab, scale_x_continuous, theme_bw and, if cost.transf = "log10", scale_y_log10 and annotation_logticks. If you specify grahical.parameters = "manual", all defaults will be ignored.

...

additional arguments, none implemented for now

References

https://github.com/Farewe/invacost

Leroy Boris, Kramer Andrew M, Vaissière Anne-Charlotte, Kourantidou Melina, Courchamp Franck & Diagne Christophe (2022). Analysing economic costs of invasive alien species with the invacost R package. Methods in Ecology and Evolution. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/2041-210X.13929")}

Examples

data(invacost)

### Cleaning steps
# Eliminating data with no information on starting and ending years
invacost <- invacost[-which(is.na(invacost$Probable_starting_year_adjusted)), ]
invacost <- invacost[-which(is.na(invacost$Probable_ending_year_adjusted)), ]
# Keeping only observed and reliable costs
invacost <- invacost[invacost$Implementation == "Observed", ]
invacost <- invacost[which(invacost$Method_reliability == "High"), ]
# Eliminating data with no usable cost value
invacost <- invacost[-which(is.na(invacost$Cost_estimate_per_year_2017_USD_exchange_rate)), ]

### Expansion

db.over.time <- expandYearlyCosts(invacost,
                                  startcolumn = "Probable_starting_year_adjusted",
                                  endcolumn = "Probable_ending_year_adjusted")
                                  
### Analysis
res <- summarizeCosts(db.over.time,
                      minimum.year = 1970,
                      maximum.year = 2020)

### Visualisation
plot(res)
plot(res, plot.type = "bars")


invacost documentation built on May 29, 2024, 3:34 a.m.