View source: R/indicator_native_range_year.R
indicator_native_range_year | R Documentation |
Based on countYearProvince plot from reporting - rshiny - grofwildjacht
indicator_native_range_year(
df,
years = NULL,
type = c("native_range", "native_continent"),
x_lab = "year",
y_lab = "alien species",
relative = FALSE,
taxon_key_col = "key",
first_observed = "first_observed"
)
df |
input data.frame. |
years |
(numeric) vector years we are interested to. If |
type |
character, native_range level of interest should be one of
|
x_lab |
character string, label of the x-axis. Default: "year". |
y_lab |
character string, label of the y-axis. Default: "number of alien species". |
relative |
(logical) if TRUE (default), each bar is standardised before stacking. |
taxon_key_col |
character. Name of the column of |
first_observed |
(character) Name of the column in |
list with:
'static_plot': ggplot object, for a given species the observed number per year and per native range is plotted in a stacked bar chart
'interactive_plot': plotly object, for a given species the observed number per year and per native range is plotted in a stacked bar chart
'data': data displayed in the plot, as data.frame with:
'year': year at which the species were introduced
'native_range': native range of the introduced species
'n': number of species introduced from the native range for a given year
'total': total number of species, from all around the world, introduced during a given year
'perc': percentage of species introduced from the native range for a given year. (n/total)*100
## Not run:
library(readr)
datafile <- paste0(
"https://raw.githubusercontent.com/trias-project/indicators/master/data/",
"interim/data_input_checklist_indicators.tsv"
)
data <- read_tsv(datafile,
na = "",
col_types = cols(
.default = col_character(),
key = col_double(),
nubKey = col_double(),
speciesKey = col_double(),
first_observed = col_double(),
last_observed = col_double()
)
)
indicator_native_range_year(data, "native_continent", years = c(2010,2013))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.