Skip to contents

boxplot_dispersion_serie() calculates the dispersion of crop prices annually relative to a global price index nad generates a boxplot visualizing the yearly dispersion of crop prices around the global price.

Usage

boxplot_dispersion_serie(
  indexes,
  global_name = "global",
  destination = tempdir(),
  output_title = NULL,
  output_format = c("none", "png", "pdf", "jpg"),
  log = TRUE,
  language = c("FR", "EN"),
  show_crops = FALSE
)

Arguments

indexes

list of dataframes, where each dataframe represents a time series of values. It is expected that one of these dataframes represents a "global" index.

global_name

character, name of the dataframe in indexes representing the global index. Default to "global".

destination

character, path to the directory where results should be saved. Used only if output_format not set to "none". Default to tempdir()

output_title

character, base name for the output file. If NULL, a default name is generated. Default to NULL

output_format

character, format of the output plot ("none", "png", "pdf", "jpg"). Default to "none" (plot will be shown in R console).

log

boolean, indicating whether to apply a logarithmic transformation to the calculated dispersion indexes. Default to TRUE.

language

character, language for the axis labels and plot title. One of c("FR", "EN"). Defaults to "FR".

show_crops

boolean, should the names of the series categories be shown on the side of the plot. Default to FALSE.

Value

Depending on value of output_format, boxplot_dispersion_serie() will return the following :

none

Plot in the R console

c(png", "pdf", "jpg")

Exported plot in the specified extension

Examples

# Preparing some plot data
if (FALSE) { # \dontrun{
series = c(
    ippap_2015 = "010538819",
    ippap_2020 = "010776418",
    cereals_2020 = "010776421",
    vineyard_2020 = "010776443",
    horticulture_2020 = "010776450"
)
download_insee_index(series, verbose = TRUE)
series_list = stats::setNames(
    read_insee_serie(file.path(tempdir(), paste0(series, ".csv"))),
    names(series)
)
# Merging ippap to obtain global series
series_list[["global"]] = merge_insee_index(
    series_list[["ippap_2015"]], series_list[["ippap_2020"]],
    retrieve_info = TRUE
)[["value"]]
series_list[c("ippap_2015", "ippap_2020")] = NULL
boxplot_dispersion_serie(indexes = series_list)
} # }