plot_edtf | R Documentation |
Use an XLSX file where cultural threats are listed and dated with EDTF. Create a flat chart or a Plotly one.
plot_edtf( data_file = paste0(system.file(package = "eamenaR"), "/extdata/disturbances_edtf.xlsx"), date_column = "EDTF", site_column = "S_ID", analyse_column = "Disturbance.Type", rm_date = NA, edft_limits = "2004-01-01..2019-12-31", edtf_unit = "ymd", edtf_analyse = c("all", "category"), edft_round = 4, id.filter = NA, type.plot = c("plotly"), freeze_y = FALSE, export.plot = FALSE, file_out = "df_out", dirOut = paste0(system.file(package = "eamenaR"), "/results/") )
data_file |
the path to the dataset. By default an XLSX file: "disturbances_edtf.xlsx". |
date_column |
the column of the EDTF data. |
site_column |
the column of the sites' names or sites' IDs. |
analyse_column |
the field name of the threat category that will be analysed: "Disturbance.Type" (default), or "Disturbance.Cause". |
rm_date |
the EDTF pattern dates that will be removed, for example c("..") removes all dates that 'occurred before' or 'occurred after'; c(":") will remove intervals; etc. By default NA |
edtf_unit |
the time unit of analysis: "ymd" = years, months and days (default); "ym" = years and months; "y" = year. |
edtf_analyse |
type of analysis. If "all" will sum the different categories of threats, if "category" will plot all categories of threats separately, on a same graphic. By default both: 'edtf_analyse = c("all", "category")' |
edft_round |
round precision for density, default 4 decimal places. |
id.filter |
if not NA, will filter on this subset of sites (e.g. 'id.filter = c("AM009")') |
type.plot |
file extension of the plot to be exported. Either "plotly" for a dynamic HTML plot, or "png" for a static plot. |
freeze_y |
if TRUE, will freeze the Y-axis on the maximum value of the density. The default this option is FALSE. |
export.plot |
if TRUE, saves the plot, if FALSE (default), displays the plot. |
file_out |
the name of the plot that will be created if 'export.plot' is TRUE |
edtf_limits |
the min and max dates of the time analysis. This interval will be crossed with the boundaries of the dataset. Useful when threats are recorded "before" (end date) or "after" (start date) a specific date. |
dataOut |
the path to the folder where the plot file will be created if 'export.plot' is TRUE |
One to several plots
# plot by category on "Disturbance Type" column (by default), grouped by month library(dplyr) plot_edtf(edtf_unit = "ym", edtf_analyse = "category") # same thing but without the EDTF dates tagged as occurred before/after, and Y-axis freezed plot_edtf(edtf_unit = "ym", edtf_analyse = "category", rm_date = "..", freeze_y = T)