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 confidence interval structure. The function allows flexible grouping, species filtering, and visualization either as faceted plots or separate panels. The function is designed to be compatible with outputs from different estimation functions within the package (e.g., para_abundance_CI, para_intensity_CI, para_prevalence_CI). Automatic detection of confidence intervals ensures flexibility across workflows. Interpretation of graphical outputs remains the responsibility of the user. It automatically detects:

Usage

para_plot_CI(para_data, group_vars, sp_cols = NULL, descriptor = NULL,
 lower_ci = NULL, upper_ci = NULL, point_color = "blue", line_size = 1,
 point_size = 3, n_cols = 1, include_zeros = TRUE, separate_plots = FALSE)

Arguments

para_data

Data frame containing parasitological descriptors and confidence intervals estimated with one of the following functions: para_abundance_CI, para_intensity_CI, para_prevalence_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).

lower_ci

Optional names of the columns containing the lower confidence. If NULL, the function automatically detects and extracts them. Default is NULL.

upper_ci

Optional names of the columns containing the upper confidence. If NULL, the function automatically detects and extracts them. Default is NULL.

point_color

Color of the points. Default is "blue".

line_size

Line width of the confidence interval 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.

Details

  • The response variable to be plotted.

  • The structure of confidence intervals, 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")

When multiple grouping variables are provided in x_var, they are combined into a single factor for visualization. Confidence intervals 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.

Value

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

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 May 13, 2026, 9:08 a.m.