para_plot_CI: Visualization of parasitological descriptor with confidence...

View source: R/para_plot_CI.R

para_plot_CIR Documentation

Visualization of parasitological descriptor with confidence intervals

Description

This function generates graphical representations of parasitological estimates (abundance, intensity, or prevalence) including their associated confidence intervals. It supports multiple input formats and automatically detects the response variable and CI structure. The function allows flexible grouping, species filtering, and visualization either as faceted plots or separate panels. The input must be the direct, unmodified output returned by one of the compatible CI functions (e.g., para_abundance_CI, para_intensity_CI, para_prevalence_CI) to ensure proper automatic detection of CIs. Manually renamed, summarized, reshaped, or otherwise restructured tables are not supported, as the function relies on the original descriptor and CI columns to automatically identify the estimates and plot the associated uncertainty. It automatically detects:

Usage

para_plot_CI(para_df, group_vars, sp_cols = NULL, descriptor = NULL,
 point_color = "blue", line_size = 1, point_size = 3, n_cols = 1,
 include_zeros = TRUE, separate_plots = FALSE, save_fig = "none",
 verbose = FALSE)

Arguments

para_df

Data frame returned directly and without modification of the following functions: para_abundance_CI, para_intensity_CI, para_prevalence_CI or para_aggregation_CI.

group_vars

Character vector specifying the variable(s) to be used on the x-axis. Multiple variables will be combined.

sp_cols

Optional vector of parasite taxa to include in the plot. Default is NULL (all taxa are included).

descriptor

Name of the variable to be plotted on the y-axis. If NULL, the function automatically detects a suitable variable (e.g., prevalence, MeanA, MedA, MeanI, MedI).

point_color

Color of the points. Default is "blue".

line_size

Line width of the CI bars. Default is 1.

point_size

Size of the points. Default is 3.

n_cols

Number of columns used in faceted plots. Default is 1.

include_zeros

Logical. If FALSE, zero values are excluded from the plot. Default is TRUE.

separate_plots

Logical. If TRUE, returns a list of plots (one per species). If FALSE, produces a faceted plot. Default is FALSE.

save_fig

Character string indicating the file format used to export the plot in the current working directory. Valid options are "none" (the plot is not saved), "pdf", "jpeg", "tiff", and "svg".

verbose

Logical. If TRUE, progress messages should be given. Default = FALSE.

Details

  • The response variable to be plotted.

  • The structure of CIs, including:

    • Separate columns (Lower_CI, Upper_CI)

    • Method-specific intervals (e.g., exact or Blaker)

    • Combined intervals stored as a single character column (e.g., "min - max")

Aggregation outputs contain multiple descriptors (e.g., VMR, mean crowding, patchiness, Poulin's D, Hoover index, and k). If descriptor is not specified, para_plot_CI() automatically plots the variance-to-mean ratio (VMR). To visualize any other aggregation index, the corresponding descriptor must be explicitly provided (e.g., descriptor = "poulin_D").

When multiple grouping variables are provided in x_var, they are combined into a single factor for visualization. CIs are displayed as vertical error bars, and point estimates are overlaid. When multiple parasite taxa are present, results are displayed using faceting or as separate plots. Interpretation of graphical outputs remains the responsibility of the user.

Value

A ggplot object or a list of ggplot objects representing the estimated values and their CIs.

Author(s)

Juan Manuel Cabrera, Exequiel Furlan and Elisa Helman

References

Bush, A.O., Lafferty, K.D., Lotz, J.M., Shostak, A.W. (1997). Parasitology meets ecology on its own terms: Margolis revisited. Journal of Parasitology, 83(4), 575–583.

Reiczigel, J., Marozzi, M., Fabian, I., Rózsa, L. (2019). Biostatistics for parasitologists – a primer to quantitative parasitology. Trends in Parasitology, 35(4), 277–281.


parasiteR documentation built on July 14, 2026, 1:08 a.m.