| Title: | Robust Ecological and Fisheries Data Analysis and Visualization |
|---|---|
| Description: | A comprehensive statistical and visualization toolkit tailored for observational data in fisheries science and aquatic ecology. Provides streamlined workflows for univariate and factorial analysis of variance (ANOVA), analysis of covariance (ANCOVA), multivariate analysis of variance (MANOVA), permutational multivariate analysis of variance (PERMANOVA), similarity percentages (SIMPER), generalized linear models, non-linear morphometric regressions, two-group hypothesis testing, and chi-square tests. Features multivariate ordination methods including non-metric multidimensional scaling (NMDS), principal component analysis (PCA), redundancy analysis (RDA), distance-based redundancy analysis (db-RDA), and hierarchical cluster dendrograms. Computes alpha diversity metrics, species accumulation curves, water quality index (WQI) values, heavy metal ecotoxicological contamination indices, correlation heatmaps, and Mantel test network linkages. Offers specialized environmental visualizations including Sankey diagrams, Likert plots, circular bar charts, and longitudinal time-series with uncertainty ribbons. Methodological formulations for multivariate permutation tests follow Anderson (2001) <doi:10.1111/j.1442-9993.2001.01070.pp.x>. Ecological community dissimilarity transformations follow Legendre and Gallagher (2001) <doi:10.1007/s004420100716>, and ecotoxicological contamination index models follow Tomlinson et al. (1980) <doi:10.1007/BF02414780>. |
| Authors: | Ataher Ali [aut, cre] (ORCID: <https://orcid.org/0009-0008-8780-0903>), Mohammed Shahidul Alam [aut] (ORCID: <https://orcid.org/0000-0003-2740-5908>) |
| Maintainer: | Ataher Ali <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.2.2 |
| Built: | 2026-10-21 20:56:17 UTC |
| Source: | https://github.com/cran/aquats |
Performs an Analysis of Covariance (ANCOVA) to test group differences in a continuous response variable while controlling for a continuous covariate. Extracts the ANCOVA summary table, estimated marginal means (EMMs), and generates a publication-ready regression scatter plot with parallel trend lines matching the additive model.
ancova_analysis( data, response_var, factor_var, covariate_var, factor_levels = NULL, facet = FALSE, color_palette = "Set1" )ancova_analysis( data, response_var, factor_var, covariate_var, factor_levels = NULL, facet = FALSE, color_palette = "Set1" )
data |
A |
response_var |
Character string; column name in |
factor_var |
Character string; column name in |
covariate_var |
Character string; column name in |
factor_levels |
Optional character vector; custom level ordering for |
facet |
Logical; if |
color_palette |
Character string; a valid |
A list containing:
ANCOVA_Table |
Analysis of variance table ( |
EMMs |
Estimated marginal means summary object from |
Plot |
The publication-ready |
Computes species richness, total abundance, Shannon-Wiener (),
Gini-Simpson (), Margalef (), Menhinick (),
and Pielou's evenness () indices simultaneously from community
abundance matrices. Automatically isolates non-numeric metadata columns,
guards against mathematical domain errors (e.g., division by zero), and
removes empty sample observations.
calc_diversity(data, group_col = NULL)calc_diversity(data, group_col = NULL)
data |
A |
group_col |
Optional character or integer vector; column name(s) or index/indices
in |
A tidy data.frame containing sample identifiers, retained metadata
columns, and the following computed diversity metrics:
Sample |
Sample row names or integer index identifiers. |
Abundance |
Total observed individual count/abundance per sample ( |
Richness |
Observed species richness count ( |
Shannon |
Shannon-Wiener diversity index ( |
Simpson |
Gini-Simpson diversity index ( |
Margalef |
Margalef richness index ( |
Menhinick |
Menhinick richness index ( |
Pielou |
Pielou's evenness index ( |
Computes five heavy metal pollution indices (HPI, HEI, Cd, PLI, and Nemerow PN) per observation or replicate. If replicated sampling is detected, it calculates station-level summary statistics including Mean, SD, SE, and 95% confidence intervals.
calc_metal_indices( data, id_col = "Station", standards = c(As = 10, Cd = 3, Cr = 50, Cu = 2000, Pb = 10, Zn = 3000), ci = 0.95, file = NULL )calc_metal_indices( data, id_col = "Station", standards = c(As = 10, Cd = 3, Cr = 50, Cu = 2000, Pb = 10, Zn = 3000), ci = 0.95, file = NULL )
data |
A |
id_col |
Character string; column name in |
standards |
Named numeric vector of permissible guideline limits ( |
ci |
Numeric; confidence level for interval estimation (e.g., |
file |
Optional character string; file path to export tabular results ( |
A list containing:
Replicate_Data |
Data frame containing computed indices for each individual sample observation. |
Summary_Data |
Data frame of station-level aggregated statistics (Mean, SD, SE, 95% CI, and pollution status). |
Computes the Weighted Arithmetic Water Quality Index (WAWQI) per observation or replicate. When replicated station sampling is detected, it calculates station-level summary statistics including Mean, SD, SE, 95% confidence intervals, and overall ecological water quality rating.
calc_wqi( data, id_col = "Station", standards = c(pH = 8.5, DO = 5, BOD = 5, TDS = 500, Turbidity = 5), ideal_values = NULL, ci = 0.95, file = NULL )calc_wqi( data, id_col = "Station", standards = c(pH = 8.5, DO = 5, BOD = 5, TDS = 500, Turbidity = 5), ideal_values = NULL, ci = 0.95, file = NULL )
data |
A |
id_col |
Character string; column name in |
standards |
Optional named numeric vector of standard regulatory limits ( |
ideal_values |
Optional named numeric vector of ideal zero-effect reference values ( |
ci |
Numeric; confidence level for interval estimation (e.g., |
file |
Optional character string; export file path for tabular results
( |
A list containing:
Replicate_Data |
Data frame containing computed sub-indices, relative weights, and overall WAWQI for each individual sample observation. |
Summary_Data |
Data frame of station-level aggregated statistics (Mean, SD, SE, 95% CI, and water quality classification rating). |
Computes ecological dissimilarity matrices (Bray-Curtis, Jaccard, Euclidean, etc.) with optional multivariate transformations (Hellinger, log, presence/absence, standardization) and performs agglomerative hierarchical clustering (UPGMA, Ward.D2, Complete). Generates a publication-ready ggplot2 dendrogram with color-coded group tips, a cluster cut-off threshold line, and a sample-to-cluster assignment table.
cluster_dendrogram( data, group_col = 1, dist_method = c("bray", "jaccard", "euclidean", "horn", "kulczynski", "gower", "manhattan", "canberra"), transform = c("none", "hellinger", "log", "pa", "standardize", "sqrt"), cluster_method = c("average", "ward.D2", "ward.D", "complete", "single", "centroid"), k = NULL, h = NULL, palette = "Set2", orientation = c("vertical", "horizontal"), title = NULL )cluster_dendrogram( data, group_col = 1, dist_method = c("bray", "jaccard", "euclidean", "horn", "kulczynski", "gower", "manhattan", "canberra"), transform = c("none", "hellinger", "log", "pa", "standardize", "sqrt"), cluster_method = c("average", "ward.D2", "ward.D", "complete", "single", "centroid"), k = NULL, h = NULL, palette = "Set2", orientation = c("vertical", "horizontal"), title = NULL )
data |
A |
group_col |
Character string or integer; column name or index in |
dist_method |
Character string; dissimilarity metric passed to |
transform |
Character string; transformation applied via |
cluster_method |
Character string; agglomeration method passed to |
k |
Optional integer; number of clusters to partition the tree into. If |
h |
Optional numeric; specific dissimilarity height threshold at which to cut the dendrogram. Default is |
palette |
Character string; a valid |
orientation |
Character string; tree layout: |
title |
Optional character string; custom plot title. Default is |
A list containing:
Plot |
A publication-ready |
Cluster_Assignments |
Tidy data frame showing sample cluster memberships. |
Distance_Matrix |
The computed |
HClust_Object |
The underlying |
Transformed_Data |
The processed numeric matrix used for distance computation. |
A curated list containing species abundance matrices for phytoplankton, zooplankton, and benthic macroinvertebrates, designed for community ecology analyses, PERMANOVA, SIMPER, and multi-matrix Mantel network visualizations.
community_mastercommunity_master
A named list with 3 data frames:
Data frame of diatom, cyanobacteria, and green algae counts.
Data frame of copepod, cladoceran, and rotifer counts.
Data frame of chironomid, oligochaete, and mollusc counts.
Evaluates equality of variances using Fisher's -test, checks group-level
normality via the Shapiro-Wilk test, and performs Student's, Welch's, or paired
-test to compare means between two groups. Automatically computes effect sizes
(Cohen's ), compiles group descriptive statistics, and generates a
publication-ready ggplot2 graphic with significance annotations.
compare_two_groups( data, response_var, group_var, var_equal = "auto", alternative = "two.sided", paired = FALSE, conf_level = 0.95, plot_type = "box", palette = "Dark2", title = NULL )compare_two_groups( data, response_var, group_var, var_equal = "auto", alternative = "two.sided", paired = FALSE, conf_level = 0.95, plot_type = "box", palette = "Dark2", title = NULL )
data |
A |
response_var |
Character string; column name in |
group_var |
Character string; column name in |
var_equal |
Character string or logical; variance assumption for independent |
alternative |
Character string; alternative hypothesis: |
paired |
Logical; if |
conf_level |
Numeric; confidence level for difference intervals and summary bounds
(e.g., |
plot_type |
Character string; visual geometry: |
palette |
Character string; a valid |
title |
Optional character string; custom plot title. Default is |
A list containing:
Summary_Table |
Tidy data frame containing sample sizes ( |
T_Test |
Tidy summary data frame of the |
F_Test |
Tidy summary data frame of Fisher's |
Normality_Test |
Tidy data frame of Shapiro-Wilk normality test results for each group. |
Plot |
A publication-ready |
Model_Objects |
A list containing raw base R test outputs ( |
Computes correlation matrices (Pearson, Spearman, or Kendall) with exact p-values and generates publication-ready heatmaps. Supports customizable shapes (squares, circles), triangle views (lower, upper, full), optional diagonal display, significance asterisks, and automated contrast text adjustment.
correlation_heatmap( data, numeric_vars = NULL, method = c("pearson", "spearman", "kendall"), shape = c("square", "circle"), view = c("lower", "upper", "full"), diag = FALSE, label_type = NULL, sig_level = NULL, color_palette = "RdBu", title = NULL )correlation_heatmap( data, numeric_vars = NULL, method = c("pearson", "spearman", "kendall"), shape = c("square", "circle"), view = c("lower", "upper", "full"), diag = FALSE, label_type = NULL, sig_level = NULL, color_palette = "RdBu", title = NULL )
data |
A |
numeric_vars |
Optional character vector; specific numeric column names in |
method |
Character string; correlation method: |
shape |
Character string; heatmap marker shape: |
view |
Character string; matrix layout view: |
diag |
Logical; whether to show diagonal self-correlations. Default is |
label_type |
Character string; content displayed inside cells: |
sig_level |
Optional numeric; significance threshold (e.g., |
color_palette |
Character string; a valid diverging palette name for |
title |
Optional character string; custom plot title. Default is |
A list containing:
Correlation_Matrix |
Symmetric matrix of correlation coefficients. |
P_Value_Matrix |
Matrix of exact |
Summary_Table |
Tidy data frame of pairwise correlations, |
Plot |
A publication-ready |
Performs constrained Distance-based Redundancy Analysis (db-RDA) using ecological dissimilarity metrics (e.g., Bray-Curtis) combined with environmental variables. Automatically cleans empty samples, runs permutation significance tests, and generates a publication-ready ggplot2 Triplot with ggrepel text positioning.
dbrda_analysis( comm_data, env_data, group_col = 1, dist_method = "bray", transform = c("none", "hellinger", "log", "pa", "wisconsin"), color_palette = "Dark2", species_arrow_mult = 1, env_arrow_mult = 1 )dbrda_analysis( comm_data, env_data, group_col = 1, dist_method = "bray", transform = c("none", "hellinger", "log", "pa", "wisconsin"), color_palette = "Dark2", species_arrow_mult = 1, env_arrow_mult = 1 )
comm_data |
A data frame or matrix where grouping columns are at the start, followed by numeric species counts. |
env_data |
A data frame or matrix containing environmental predictor variables.
Must have the exact same number of rows as |
group_col |
Character string or integer; column name or index in |
dist_method |
Character string; dissimilarity metric for community abundance data
(e.g., |
transform |
Character string; pre-transformation applied to community abundance data
via |
color_palette |
Character string; a valid |
species_arrow_mult |
Numeric; scaling multiplier for species vector arrows. Default is |
env_arrow_mult |
Numeric; scaling multiplier for environmental vector arrows. Default is |
A list containing:
dbRDA_Object |
The underlying |
Model_Significance |
Permutation ANOVA test for overall model significance. |
Variable_Significance |
Permutation ANOVA test for marginal term significance. |
Plot |
The publication-ready |
Fits generalized linear models (GLM) across Gaussian, Poisson, Binomial, and Gamma families with publication-ready diagnostic and prediction graphics.
glm_analysis( data, response_var, predictor_vars, family_type = "poisson", color_palette = "Set1" )glm_analysis( data, response_var, predictor_vars, family_type = "poisson", color_palette = "Set1" )
data |
A |
response_var |
Character string; column name in |
predictor_vars |
Character vector; column name(s) in |
family_type |
Character string; error distribution family: |
color_palette |
Character string; a valid |
A list containing:
Model |
The fitted |
Summary |
Summary specification of the fitted model ( |
Anova_Table |
Analysis of deviance table ( |
Plot |
A publication-ready |
A comprehensive, unified dataset containing morphological measurements, environmental parameters, catch records, and multi-factor experimental groupings for Hilsa shad (Tenualosa ilisha) across various habitats, seasons, and size classes. Designed to power all parametric, non-parametric, regression, and multivariate functions in the package.
hilsa_masterhilsa_master
A data frame with 120 rows and 14 variables:
Factor; sampling environment (Marine, Estuary, River).
Factor; fishing season (Monsoon, Dry).
Factor; growth stage (Juvenile, Adult).
Numeric; body weight in grams.
Numeric; total length in centimeters.
Numeric; maximum body depth in centimeters.
Numeric; head length in centimeters.
Numeric; pectoral fin length in centimeters.
Numeric; fishing effort in hours.
Integer; number of fish caught (count response).
Numeric; Sea Surface Temperature in degrees Celsius.
Numeric; water salinity in parts per thousand.
Numeric; water depth in meters.
Numeric; total fish catch in kilograms.
Performs a one-way MANOVA across multiple continuous response variables grouped by a categorical factor, extracts multivariate test statistics (Pillai's Trace), provides univariate ANOVA breakdowns, and generates either faceted trait boxplots or a Canonical Discriminant Analysis (LDA) multivariate ordination scatter plot.
manova_analysis( data, response_vars, factor_var, factor_levels = NULL, plot_type = "boxplot", color_palette = "Set1" )manova_analysis( data, response_vars, factor_var, factor_levels = NULL, plot_type = "boxplot", color_palette = "Set1" )
data |
A |
response_vars |
Character vector; column names in |
factor_var |
Character string; column name in |
factor_levels |
Optional character vector; custom level ordering for |
plot_type |
Character string; visualization layout: |
color_palette |
Character string; a valid |
A list containing:
MANOVA_Summary |
Multivariate test summary table based on Pillai's trace. |
Univariate_ANOVAs |
Univariate ANOVA summary tables for each response variable. |
Plot |
The publication-ready |
Computes pairwise environmental correlations while performing Mantel tests across single or multiple biological communities (e.g., Phytoplankton, Zooplankton, Benthos, Fish). Generates publication-ready network diagrams with customizable straight or curved linkages and anchor pins.
mantel_heatmap_analysis( comm_data, env_data, plot_type = c("network", "bars"), line_style = c("curve", "straight"), method = c("pearson", "spearman"), spec_dist = "bray", env_dist = "euclidean", transform = c("none", "hellinger", "log", "pa", "sqrt"), only_significant = FALSE, line_color_by = c("significance", "community"), permutations = 999, seed = 42, show_cor_text = TRUE, color_palette = "RdBu", title = NULL )mantel_heatmap_analysis( comm_data, env_data, plot_type = c("network", "bars"), line_style = c("curve", "straight"), method = c("pearson", "spearman"), spec_dist = "bray", env_dist = "euclidean", transform = c("none", "hellinger", "log", "pa", "sqrt"), only_significant = FALSE, line_color_by = c("significance", "community"), permutations = 999, seed = 42, show_cor_text = TRUE, color_palette = "RdBu", title = NULL )
comm_data |
A |
env_data |
A |
plot_type |
Character string; visualization layout: |
line_style |
Character string; linkage geometry: |
method |
Character string; correlation method: |
spec_dist |
Character string; dissimilarity metric for community abundance data (e.g., |
env_dist |
Character string; distance metric for environmental parameters. Default is |
transform |
Character string; transformation applied to community counts via |
only_significant |
Logical; if |
line_color_by |
Character string; variable mapping for linkage line colors: |
permutations |
Numeric integer; number of Monte Carlo permutations for Mantel significance testing. Default is |
seed |
Optional integer; random seed for reproducible permutations. Default is |
show_cor_text |
Logical; if |
color_palette |
Character string; a valid diverging |
title |
Optional character string; master figure title. Default is |
A list containing:
Plot |
The primary publication-ready |
Correlation_Matrix |
Symmetric matrix of environmental correlation coefficients. |
Mantel_Results |
Tidy data frame containing community-specific Mantel |
Performs NMDS ordination with automated data transformations (Hellinger, log, etc.), stress quality checks, and generates a publication-ready ggplot2 scatterplot with 95
nmds_analysis( data, group_col = 1, env_data = NULL, dist_method = "bray", transform = c("none", "hellinger", "log", "pa", "wisconsin"), k = 2, trymax = 100, palette = "Dark2", title = NULL )nmds_analysis( data, group_col = 1, env_data = NULL, dist_method = "bray", transform = c("none", "hellinger", "log", "pa", "wisconsin"), k = 2, trymax = 100, palette = "Dark2", title = NULL )
data |
A |
group_col |
Character string or integer; column name or index in |
env_data |
Optional |
dist_method |
Character string; dissimilarity metric passed to |
transform |
Character string; pre-transformation applied to community counts via |
k |
Numeric integer; number of ordination dimensions. Default is |
trymax |
Numeric integer; maximum number of random starts for |
palette |
Character string; a valid |
title |
Optional character string; custom plot title. Default is |
A list containing:
Plot |
A publication-ready |
Plot_Data |
Tidy data frame of NMDS site coordinates and grouping factors. |
Stress |
The final stress value of the ordination. |
NMDS_Object |
The underlying |
Envfit_Results |
Vector fit results from |
This function performs a one-way ANOVA, calculates Tukey's HSD post-hoc test, extracts Estimated Marginal Means (EMMs), and generates a publication-ready plot with optional faceting by a secondary categorical variable.
one_way_anova( data, factor_var, numeric_var, facet_var = NULL, factor_levels = NULL, plot_type = "boxplot", error_type = "se", sig_display = "letters", y_limits = NULL, add_jitter = TRUE, show_mean = TRUE, mean_color = "darkred", color_palette = "Set1" )one_way_anova( data, factor_var, numeric_var, facet_var = NULL, factor_levels = NULL, plot_type = "boxplot", error_type = "se", sig_display = "letters", y_limits = NULL, add_jitter = TRUE, show_mean = TRUE, mean_color = "darkred", color_palette = "Set1" )
data |
A data frame containing the variables for analysis. |
factor_var |
Character string; column name in |
numeric_var |
Character string; column name in |
facet_var |
Optional character string; column name in |
factor_levels |
Optional character vector; custom level ordering for |
plot_type |
Character string; display geometry: |
error_type |
Character string; error bar dispersion metric for bar and point-range plots: |
sig_display |
Character string; method to annotate statistical significance: |
y_limits |
Optional numeric vector of length 2; lower and upper limits for the y-axis (e.g., |
add_jitter |
Logical; if |
show_mean |
Logical; if |
mean_color |
Character string; hex code or color name for group mean indicators. Default is |
color_palette |
Character string; a valid |
A list containing:
ANOVA_Summary |
Global ANOVA summary table (F-statistic and p-value). |
TukeyHSD |
Tukey HSD post-hoc pairwise comparisons. |
EMMs |
Estimated Marginal Means object from |
Summary_Table |
Aggregated sample sizes, means, SDs, SEs, and confidence limits. |
Plot |
The publication-ready |
Performs Principal Component Analysis (PCA / RDA) on aquatic community data. Generates a publication-ready ggplot2 biplot showing site coordinates with 95
pca_community_biplot( data, group_col = 1, scale = FALSE, transform = c("none", "hellinger", "log", "pa", "wisconsin"), top_n_species = NULL, color_palette = "Dark2", arrow_multiplier = 1, title = NULL )pca_community_biplot( data, group_col = 1, scale = FALSE, transform = c("none", "hellinger", "log", "pa", "wisconsin"), top_n_species = NULL, color_palette = "Dark2", arrow_multiplier = 1, title = NULL )
data |
A |
group_col |
Character string or integer; column name or index in |
scale |
Logical; whether to standardize species variables to unit variance.
Setting to |
transform |
Character string; pre-transformation applied to community counts via
|
top_n_species |
Optional integer; number of top species to display based on vector loading length
to reduce text clutter. If |
color_palette |
Character string; a valid |
arrow_multiplier |
Numeric; scaling multiplier for species loading arrows. Default is |
title |
Optional character string; custom plot title. Default is |
A list containing:
Plot |
A publication-ready |
Plot_Data |
Tidy data frame of site PC scores and grouping metadata. |
Species_Scores |
Tidy data frame of species loadings and vector coordinates. |
PCA_Object |
The underlying |
Generates a publication-grade PCA correlation circle (variables factor map)
using base stats and ggplot2. Colors environmental parameters by their
representation quality () on the selected principal components.
pca_correlation_circle( data, exclude_cols = 1, dim1 = 1, dim2 = 2, palette = c("#2A9D8F", "#E9C46A", "#F4A261", "#E76F51"), title = NULL )pca_correlation_circle( data, exclude_cols = 1, dim1 = 1, dim2 = 2, palette = c("#2A9D8F", "#E9C46A", "#F4A261", "#E76F51"), title = NULL )
data |
A |
exclude_cols |
Optional character or integer vector; column names or indices in |
dim1 |
Numeric integer; index of the first principal component to plot on the x-axis. Default is |
dim2 |
Numeric integer; index of the second principal component to plot on the y-axis. Default is |
palette |
Character vector; hex color codes defining the color gradient for
representation quality ( |
title |
Optional character string; custom plot title. Default is |
A list containing:
Plot |
A publication-ready |
Variable_Stats |
Data frame of variable coordinates, correlations, and |
Variance_Summary |
Data frame detailing eigenvalues and percentage variance explained per PC. |
Sample_Scores |
Data frame of sample/station scores along the principal components. |
PCA_Object |
The underlying |
Performs PERMANOVA (using vegan::adonis2) to test for statistical differences
in community composition between groups. Automatically cleans empty samples, validates
numeric matrices, supports ecological transformations, and handles flexible data ingestion.
permanova_analysis( data, group_col = 1, dist_method = "bray", transform = c("none", "hellinger", "log", "pa", "wisconsin"), permutations = 999, seed = 42 )permanova_analysis( data, group_col = 1, dist_method = "bray", transform = c("none", "hellinger", "log", "pa", "wisconsin"), permutations = 999, seed = 42 )
data |
A |
group_col |
Character string or integer; column name or index in |
dist_method |
Character string; dissimilarity or distance metric passed to
|
transform |
Character string; pre-transformation applied to community counts via
|
permutations |
Numeric integer; number of Monte Carlo permutations for significance
testing. Default is |
seed |
Optional integer; random seed for reproducible permutation testing.
Default is |
A list containing:
PERMANOVA_Table |
The ANOVA-style permutation results table ( |
Cleaned_Data |
A data frame combining the filtered grouping factor and community matrix. |
Distance_Method |
Character string indicating the dissimilarity metric applied. |
Generates publication-ready bar and lollipop plots from a data frame, CSV, or Excel file. Supports frequency counting, summary metric aggregation (mean, sum, identity), grouped/stacked arrangements, automated data labelling, coordinate flipping, and multi-column batch plotting.
plot_bar( data, x, y = NULL, group = NULL, type = c("bar", "lollipop"), stat = c("mean", "sum", "identity"), position = c("dodge", "stack", "fill"), show_labels = FALSE, horizontal = FALSE, palette = "Set2", bar_width = 0.7, point_size = 3.5, line_size = 0.8, xlab = NULL, ylab = NULL, title_prefix = "" ) plot_lollipop(..., point_size = 3.5, line_size = 0.8)plot_bar( data, x, y = NULL, group = NULL, type = c("bar", "lollipop"), stat = c("mean", "sum", "identity"), position = c("dodge", "stack", "fill"), show_labels = FALSE, horizontal = FALSE, palette = "Set2", bar_width = 0.7, point_size = 3.5, line_size = 0.8, xlab = NULL, ylab = NULL, title_prefix = "" ) plot_lollipop(..., point_size = 3.5, line_size = 0.8)
data |
A |
x |
Character vector; column name(s) in |
y |
Optional character vector; column name(s) in |
group |
Optional character string; column name in |
type |
Character string; visual geometry style: |
stat |
Character string; aggregation statistic when |
position |
Character string; arrangement geometry: |
show_labels |
Logical; if |
horizontal |
Logical; if |
palette |
Character string; a valid |
bar_width |
Numeric; relative width of bars or spacing factor for dodging. Default is |
point_size |
Numeric; size of the marker heads when |
line_size |
Numeric; width of the stem lines when |
xlab |
Optional character string; custom x-axis title. Default is |
ylab |
Optional character string; custom y-axis title. Default is |
title_prefix |
Optional character string; text prefix prepended to the plot title. Default is |
... |
Additional arguments passed to |
A single ggplot2 object, or a named list of ggplot2 objects
if batch plotting across multiple columns.
Builds circular bar charts with concentric reference gridlines, scale labels, and category labels. Best suited for data with six or more categories.
plot_circular_bar( data, x, y = NULL, group = NULL, stat = c("mean", "sum", "identity"), inner_radius = 0.35, show_grid = TRUE, palette = "Set2", title = NULL )plot_circular_bar( data, x, y = NULL, group = NULL, stat = c("mean", "sum", "identity"), inner_radius = 0.35, show_grid = TRUE, palette = "Set2", title = NULL )
data |
A |
x |
Character string; column name in |
y |
Optional character string; column name in |
group |
Optional character string; column name in |
stat |
Character string; aggregation statistic when |
inner_radius |
Numeric; fractional proportion of the plot radius reserved for the
central inner void (between 0 and 1). Default is |
show_grid |
Logical; if |
palette |
Character string; a valid |
title |
Optional character string; custom plot title. Default is |
A publication-ready ggplot2 object.
Generates publication-ready boxplots for alpha diversity metrics across single or two-factor environmental groupings. Provides optional parametric (ANOVA) or non-parametric (Kruskal-Wallis) hypothesis testing, with optional faceting.
plot_diversity( data, group_col = 1, facet_var = NULL, index = c("shannon", "simpson", "richness", "abundance", "margalef", "menhinick", "pielou"), test = c("anova", "kruskal", "none"), color_palette = "Dark2", permutations = 1000, file = NULL )plot_diversity( data, group_col = 1, facet_var = NULL, index = c("shannon", "simpson", "richness", "abundance", "margalef", "menhinick", "pielou"), test = c("anova", "kruskal", "none"), color_palette = "Dark2", permutations = 1000, file = NULL )
data |
A |
group_col |
Character string or integer vector; column name(s) or index/indices in |
facet_var |
Optional character string; column name in |
index |
Character string; alpha diversity metric to compute and plot:
|
test |
Character string; statistical hypothesis test to perform across groups:
|
color_palette |
Character string; a valid |
permutations |
Numeric integer; number of bootstrap iterations for confidence intervals. Default is |
file |
Optional character string; export file path for summary tables ( |
A list containing:
Diversity_Data |
Data frame of individual sample diversity metric values. |
Group_Summary |
Data frame of aggregated group-level summary statistics. |
Test_Result |
Statistical test summary object ( |
Plot |
A publication-ready |
Generates publication-ready single or nested multi-layered (sunburst) donut charts. Supports up to three concentric hierarchical tiers with automatic alignment and percentage threshold labelling.
plot_donut( data, levels, value = NULL, show_labels = TRUE, min_percent = 4, palette = "Set2", title = NULL )plot_donut( data, levels, value = NULL, show_labels = TRUE, min_percent = 4, palette = "Set2", title = NULL )
data |
A |
levels |
Character vector; column names in |
value |
Optional character string; column name in |
show_labels |
Logical; if |
min_percent |
Numeric; minimum percentage (0 to 100) required to display a text label
on a segment to prevent visual clutter. Default is |
palette |
Character string; a valid |
title |
Optional character string; custom plot title. Default is |
A publication-ready ggplot2 object.
Generates publication-ready frequency histograms for continuous fisheries and environmental variables. Supports optional kernel density curves, theoretical normal distribution overlays, and mean/median reference lines.
plot_histogram( data, x, group = NULL, bins = 30, binwidth = NULL, add_density = FALSE, add_normal = FALSE, show_stats = TRUE, facet = FALSE, palette = "Blues", xlab = NULL, ylab = "Frequency", title = NULL )plot_histogram( data, x, group = NULL, bins = 30, binwidth = NULL, add_density = FALSE, add_normal = FALSE, show_stats = TRUE, facet = FALSE, palette = "Blues", xlab = NULL, ylab = "Frequency", title = NULL )
data |
A |
x |
Character string; column name in |
group |
Optional character string; column name in |
bins |
Numeric integer; number of histogram bins. Default is |
binwidth |
Optional numeric; explicit width of the histogram bins (overrides |
add_density |
Logical; if |
add_normal |
Logical; if |
show_stats |
Logical; if |
facet |
Logical; if |
palette |
Character string; a valid |
xlab |
Optional character string; custom x-axis label. Default is |
ylab |
Optional character string; custom y-axis label. Default is |
title |
Optional character string; custom plot title. Default is |
A publication-ready ggplot2 object.
Generates modern diverging or 100% stacked horizontal bar charts for survey items and perception data.
plot_likert( data, items, levels = NULL, type = c("diverging", "stacked"), palette = "RdYlBu", show_labels = TRUE, clean_labels = TRUE, title = NULL )plot_likert( data, items, levels = NULL, type = c("diverging", "stacked"), palette = "RdYlBu", show_labels = TRUE, clean_labels = TRUE, title = NULL )
data |
A |
items |
Character vector; column names in |
levels |
Optional character vector; custom ordered levels of the Likert response scale
(e.g., from strongly disagree to strongly agree). Default is |
type |
Character string; plot display style: |
palette |
Character string; a valid |
show_labels |
Logical; if |
clean_labels |
Logical; if |
title |
Optional character string; custom plot title. Default is |
A publication-ready ggplot2 object.
Generates publication-ready plots for heavy metal pollution metrics (HPI, HEI, Cd, PLI, or Nemerow PN) across monitoring stations, featuring 95% confidence interval whiskers, regulatory benchmark lines, and intuitive status fills.
plot_metal_indices( data, metric = c("HPI", "HEI", "Cd", "PLI", "Nemerow_PN"), id_col = "Station", type = c("bar", "lollipop"), show_ci = TRUE, show_threshold = TRUE, palette = "auto", title = NULL, ... )plot_metal_indices( data, metric = c("HPI", "HEI", "Cd", "PLI", "Nemerow_PN"), id_col = "Station", type = c("bar", "lollipop"), show_ci = TRUE, show_threshold = TRUE, palette = "auto", title = NULL, ... )
data |
A |
metric |
Character string; index to visualize: |
id_col |
Character string; column name in |
type |
Character string; plot display geometry: |
show_ci |
Logical; if |
show_threshold |
Logical; if |
palette |
Character string; status color theme: |
title |
Optional character string; custom plot title. Default is |
... |
Additional arguments passed to |
A publication-ready ggplot2 object.
Generates an isometric 3D pie chart with perspective tilt, extruded
depth ribbons, and realistic shading natively in ggplot2.
plot_pie3d( data, x, y = NULL, stat = c("sum", "mean", "identity"), tilt = 0.5, depth = 0.25, show_labels = TRUE, min_percent = 4, palette = "Set2", title = NULL )plot_pie3d( data, x, y = NULL, stat = c("sum", "mean", "identity"), tilt = 0.5, depth = 0.25, show_labels = TRUE, min_percent = 4, palette = "Set2", title = NULL )
data |
A |
x |
Character string; column name in |
y |
Optional character string; column name in |
stat |
Character string; aggregation statistic when |
tilt |
Numeric; perspective vertical compression factor between 0.2 and 0.8. Default is |
depth |
Numeric; extrusion depth thickness for the 3D base rim. Default is |
show_labels |
Logical; if |
min_percent |
Numeric; minimum threshold percentage required to display slice label text. Default is |
palette |
Character string; a valid |
title |
Optional character string; custom plot title. Default is |
A publication-ready ggplot2 object.
Generates publication-ready multi-tier alluvial and Sankey flow diagrams
to visualize categorical transitions, trophic pathways, diet shifts, or
spatial routing in ecological and environmental data. Automatically pre-aggregates
frequencies, guards against missing strata, dynamically adapts color palettes,
and returns a fully customizable ggplot2 object.
plot_sankey( data, axes, value = NULL, fill_axis = 1, alpha = 0.65, width = 0.25, stratum_fill = "grey92", stratum_color = "grey40", label_size = 3.5, palette = "Set2", title = NULL )plot_sankey( data, axes, value = NULL, fill_axis = 1, alpha = 0.65, width = 0.25, stratum_fill = "grey92", stratum_color = "grey40", label_size = 3.5, palette = "Set2", title = NULL )
data |
A |
axes |
Character vector; column names in |
value |
Optional character string; column name in |
fill_axis |
Character string or integer; column name or index in |
alpha |
Numeric; transparency of the alluvial flow ribbons (between 0 and 1).
Default is |
width |
Numeric; relative horizontal width of stratum bars (between 0 and 1).
Default is |
stratum_fill |
Character string; fill color of the stratum bounding boxes.
Default is |
stratum_color |
Character string; border color of the stratum bounding boxes.
Default is |
label_size |
Numeric; font size for stratum category labels. Default is |
palette |
Character string; a valid |
title |
Optional character string; custom plot title. Default is |
A publication-ready ggplot2 alluvial diagram object.
Generates publication-ready time-series and line graphs for aquatic,
limnological, and fisheries datasets. Supports single-factor trajectories,
two-factor comparisons, and three-factor nested layouts with automated
replicate aggregation (Mean SE, SD, or 95
plot_timeseries( data, time_var, y_var, color_var = NULL, linetype_var = NULL, facet_var = NULL, ribbon = c("ci", "se", "sd", "none"), show_points = TRUE, point_size = 2.5, line_width = 1, ribbon_alpha = 0.2, smooth = FALSE, color_palette = "Dark2", xlab = NULL, ylab = NULL, title = NULL )plot_timeseries( data, time_var, y_var, color_var = NULL, linetype_var = NULL, facet_var = NULL, ribbon = c("ci", "se", "sd", "none"), show_points = TRUE, point_size = 2.5, line_width = 1, ribbon_alpha = 0.2, smooth = FALSE, color_palette = "Dark2", xlab = NULL, ylab = NULL, title = NULL )
data |
A |
time_var |
Character string; column name in |
y_var |
Character string; column name in |
color_var |
Optional character string; column name in |
linetype_var |
Optional character string; column name in |
facet_var |
Optional character string; column name in |
ribbon |
Character string; uncertainty band style when replicates exist per time point:
|
show_points |
Logical; if |
point_size |
Numeric; size of data points. Default is |
line_width |
Numeric; thickness of trajectory lines. Default is |
ribbon_alpha |
Numeric; opacity of uncertainty ribbons (0 to 1). Default is |
smooth |
Logical; if |
color_palette |
Character string; a valid |
xlab |
Optional character string; custom x-axis label. Default is |
ylab |
Optional character string; custom y-axis label. Default is |
title |
Optional character string; custom plot title. Default is |
A list containing:
Plot |
The publication-ready |
Summary_Data |
A tidy data frame of aggregated Means, SDs, SEs, and Confidence Intervals. |
Generates publication-ready WQI plots across monitoring stations with 95% confidence interval whiskers, status fills, and background benchmark bands for WAWQI classification tiers.
plot_wqi( data, id_col = "Station", type = c("bar", "lollipop"), show_ci = TRUE, show_bands = TRUE, title = NULL, ... )plot_wqi( data, id_col = "Station", type = c("bar", "lollipop"), show_ci = TRUE, show_bands = TRUE, title = NULL, ... )
data |
A |
id_col |
Character string; column name in |
type |
Character string; plot display geometry: |
show_ci |
Logical; if |
show_bands |
Logical; if |
title |
Optional character string; custom plot title. Default is |
... |
Additional arguments passed to |
A publication-ready ggplot2 object.
Performs constrained Redundancy Analysis (RDA) combining community and environmental data. Automatically cleans empty samples from both datasets, runs permutation significance tests, and generates a publication-ready ggplot2 Triplot with ggrepel label adjustments.
rda_analysis( comm_data, env_data, group_col = 1, transform = c("none", "hellinger", "log", "pa", "wisconsin"), color_palette = "Dark2", species_arrow_mult = 1, env_arrow_mult = 1 )rda_analysis( comm_data, env_data, group_col = 1, transform = c("none", "hellinger", "log", "pa", "wisconsin"), color_palette = "Dark2", species_arrow_mult = 1, env_arrow_mult = 1 )
comm_data |
A |
env_data |
A |
group_col |
Character string or integer; column name or index in |
transform |
Character string; pre-transformation applied to community counts via
|
color_palette |
Character string; a valid |
species_arrow_mult |
Numeric; scaling multiplier for species vector arrows. Default is |
env_arrow_mult |
Numeric; scaling multiplier for environmental vector arrows. Default is |
A list containing:
RDA_Object |
The underlying |
Model_Significance |
Permutation ANOVA test for overall model significance. |
Variable_Significance |
Permutation ANOVA test for marginal term significance. |
Plot |
The publication-ready |
Fits linear, allometric power, exponential, logarithmic, quadratic polynomial, or cubic regression models. Automatically formats algebraic mathematical formulas, R-squared values, and p-values, displays confidence or prediction intervals, and renders publication-ready ggplot2 graphics.
regression_analysis( data, x_var, y_var, fit_type = c("linear", "power", "exponential", "logarithmic", "polynomial", "cubic"), group_var = NULL, facet = FALSE, interval = c("confidence", "prediction", "none"), show_equation = TRUE, color_palette = "Set1", point_size = 2.2, point_alpha = 0.75, title = NULL )regression_analysis( data, x_var, y_var, fit_type = c("linear", "power", "exponential", "logarithmic", "polynomial", "cubic"), group_var = NULL, facet = FALSE, interval = c("confidence", "prediction", "none"), show_equation = TRUE, color_palette = "Set1", point_size = 2.2, point_alpha = 0.75, title = NULL )
data |
A |
x_var |
Character string; column name in |
y_var |
Character string; column name in |
fit_type |
Character string; regression model functional form: |
group_var |
Optional character string; column name in |
facet |
Logical; if |
interval |
Character string; uncertainty band type: |
show_equation |
Logical; if |
color_palette |
Character string; a valid |
point_size |
Numeric; size of scatter plot points. Default is |
point_alpha |
Numeric; opacity of scatter plot points (0 to 1). Default is |
title |
Optional character string; custom plot title. Default is |
A list containing:
Plot |
Publication-ready |
Models |
Named list of fitted |
Equation_Table |
Data frame of algebraic formulas, |
Predictions |
Data frame of calculated predictions with confidence/prediction limits. |
Identifies which species primarily contribute to the differences between groups
using Bray-Curtis dissimilarity decomposition (vegan::simper).
Automatically cleans empty samples, validates missing values, supports ecological
transformations, and generates a publication-ready ggplot2 bar chart.
simper_analysis( data, group_col = 1, top_n = 5, transform = c("none", "hellinger", "log", "pa", "wisconsin"), permutations = 999, seed = 42 )simper_analysis( data, group_col = 1, top_n = 5, transform = c("none", "hellinger", "log", "pa", "wisconsin"), permutations = 999, seed = 42 )
data |
A |
group_col |
Character string or integer; column name or index in |
top_n |
Numeric integer; number of top contributing species to display per
pairwise comparison. Default is |
transform |
Character string; pre-transformation applied to community counts
via |
permutations |
Numeric integer; number of permutations for |
seed |
Optional integer; random seed for reproducible permutation testing.
Default is |
A list containing:
SIMPER_Object |
The raw |
Summary_Table |
Tidy data frame of top contributing species, average contributions, cumulative percentages, and significance per group comparison. |
Plot |
A publication-ready |
Computes and plots species accumulation curves using vegan::specaccum.
Supports pooled curves or comparative grouped curves across habitats,
handles methods without standard deviations defensively, and formats
outputs with publication-ready styling.
specaccum_plot( data, group_col = 1, by_group = FALSE, method = "exact", palette = "Set2", line_color = "#2A9D8F", ci = 1.96, show_ci = TRUE, title = NULL )specaccum_plot( data, group_col = 1, by_group = FALSE, method = "exact", palette = "Set2", line_color = "#2A9D8F", ci = 1.96, show_ci = TRUE, title = NULL )
data |
A |
group_col |
Character string or integer vector; column name(s) or index/indices in |
by_group |
Logical; if |
method |
Character string; accumulation method passed to |
palette |
Character string; a valid |
line_color |
Character string; hex code or color name for single pooled curves. Default is |
ci |
Numeric; multiplier for confidence intervals (e.g., |
show_ci |
Logical; if |
title |
Optional character string; custom plot title. Default is |
A list containing:
Specaccum_Object |
The raw |
Curve_Data |
A tidy data frame with sampling effort, estimated species richness, and confidence bounds. |
Plot |
The publication-ready |
Computes descriptive statistics (N, Mean, SD, SE, Median, Min, Max, and Mean SD)
for numeric variables across optional grouping factors. Supports direct file
ingestion and exporting publication-ready tables directly to Excel (.xlsx) or CSV.
summarize_obs(data, vars = NULL, group = NULL, digits = 2, file = NULL)summarize_obs(data, vars = NULL, group = NULL, digits = 2, file = NULL)
data |
A |
vars |
Optional character vector; column names in |
group |
Optional character vector; column name(s) in |
digits |
Numeric integer; number of decimal places for rounding reported statistics.
Default is |
file |
Optional character string; export file path for the resulting summary table
(must end in |
A tidy data.frame containing computed descriptive metrics.
# Generate self-contained sample survey data fish_survey <- data.frame( River = rep(c("River A", "River B"), each = 15), Length = c(rnorm(15, 20, 2), rnorm(15, 24, 3)), Weight = c(rnorm(15, 120, 15), rnorm(15, 180, 20)) ) summary_tbl <- summarize_obs( data = fish_survey, vars = c("Length", "Weight"), group = "River", digits = 2 ) head(summary_tbl)# Generate self-contained sample survey data fish_survey <- data.frame( River = rep(c("River A", "River B"), each = 15), Length = c(rnorm(15, 20, 2), rnorm(15, 24, 3)), Weight = c(rnorm(15, 120, 15), rnorm(15, 180, 20)) ) summary_tbl <- summarize_obs( data = fish_survey, vars = c("Length", "Weight"), group = "River", digits = 2 ) head(summary_tbl)
Performs Pearson's Chi-Square () test of independence or goodness-of-fit
on categorical survey, ecological, or environmental frequency data. Automatically
evaluates expected cell frequencies, applies Yates' continuity correction or Monte Carlo
simulation when sample sizes are small, computes effect sizes (Cramér's and
Phi coefficient ), extracts standardized Pearson residuals, and generates a
publication-ready ggplot2 stacked or dodged bar chart.
test_chisq( data, x, y = NULL, p = NULL, correct = TRUE, simulate_p = TRUE, B = 2000, plot_type = "stacked", palette = "Set2", title = NULL )test_chisq( data, x, y = NULL, p = NULL, correct = TRUE, simulate_p = TRUE, B = 2000, plot_type = "stacked", palette = "Set2", title = NULL )
data |
A |
x |
Character string; column name in |
y |
Optional character string; column name in |
p |
Optional numeric vector; theoretical probabilities for the goodness-of-fit test
when |
correct |
Logical; if |
simulate_p |
Logical; if |
B |
Numeric integer; number of Monte Carlo replicates used when |
plot_type |
Character string; visual geometry: |
palette |
Character string; a valid |
title |
Optional character string; custom plot title. Default is |
A list containing:
Chi_Square_Test |
Tidy data frame containing the |
Observed_Counts |
Cross-tabulated data frame of observed cell frequencies with marginal totals. |
Expected_Counts |
Data frame of theoretical expected cell frequencies under the null hypothesis of independence. |
Standardized_Residuals |
Data frame of standardized Pearson residuals ( |
Plot |
A publication-ready |
Model_Object |
The underlying |
Performs a three-way factorial ANOVA with full interaction effects, calculates Tukey's HSD post-hoc tests, extracts Estimated Marginal Means (EMMs), and generates faceted publication-ready interaction plots with compact letter displays. Automatically handles NA values safely, converts matrix inputs, and coerces categorical variables.
three_way_anova( data, factor1_var, factor2_var, factor3_var, numeric_var, factor1_levels = NULL, factor2_levels = NULL, factor3_levels = NULL, plot_type = "boxplot", error_type = "se", y_limits = NULL, add_jitter = TRUE, show_mean = TRUE, mean_color = "darkred", color_palette = "Set1" )three_way_anova( data, factor1_var, factor2_var, factor3_var, numeric_var, factor1_levels = NULL, factor2_levels = NULL, factor3_levels = NULL, plot_type = "boxplot", error_type = "se", y_limits = NULL, add_jitter = TRUE, show_mean = TRUE, mean_color = "darkred", color_palette = "Set1" )
data |
A data frame or matrix in long format containing the variables for analysis. |
factor1_var |
Character string; column name in |
factor2_var |
Character string; column name in |
factor3_var |
Character string; column name in |
numeric_var |
Character string; column name in |
factor1_levels |
Optional character vector; custom level ordering for factor 1. Default is |
factor2_levels |
Optional character vector; custom level ordering for factor 2. Default is |
factor3_levels |
Optional character vector; custom level ordering for factor 3. Default is |
plot_type |
Character string; display geometry: |
error_type |
Character string; error bar dispersion metric: |
y_limits |
Optional numeric vector of length 2; lower and upper limits for the y-axis (e.g., |
add_jitter |
Logical; if |
show_mean |
Logical; if |
mean_color |
Character string; hex code or color name for group mean indicators. Default is |
color_palette |
Character string; a valid |
A list containing:
ANOVA_Summary |
Global ANOVA summary table with 3-way interaction terms. |
TukeyHSD |
Tukey HSD pairwise comparison results across interaction levels. |
EMMs |
Estimated Marginal Means object from |
Summary_Table |
Aggregated sample sizes, means, SDs, SEs, and confidence limits. |
Plot |
The publication-ready faceted |
Performs a two-way factorial ANOVA with interaction effects, calculates Tukey's HSD post-hoc tests, extracts Estimated Marginal Means (EMMs), and generates publication-ready interaction plots with optional facetting.
two_way_anova( data, factor1_var, factor2_var, numeric_var, facet_var = NULL, factor1_levels = NULL, factor2_levels = NULL, plot_type = "boxplot", error_type = "se", y_limits = NULL, add_jitter = TRUE, show_mean = TRUE, mean_color = "darkred", color_palette = "Set1" )two_way_anova( data, factor1_var, factor2_var, numeric_var, facet_var = NULL, factor1_levels = NULL, factor2_levels = NULL, plot_type = "boxplot", error_type = "se", y_limits = NULL, add_jitter = TRUE, show_mean = TRUE, mean_color = "darkred", color_palette = "Set1" )
data |
A data frame containing the variables for analysis. |
factor1_var |
Character string; column name in |
factor2_var |
Character string; column name in |
numeric_var |
Character string; column name in |
facet_var |
Optional character string; column name in |
factor1_levels |
Optional character vector; custom level ordering for factor 1. Default is |
factor2_levels |
Optional character vector; custom level ordering for factor 2. Default is |
plot_type |
Character string; display geometry: |
error_type |
Character string; error bar dispersion metric: |
y_limits |
Optional numeric vector of length 2; lower and upper limits for the y-axis (e.g., |
add_jitter |
Logical; if |
show_mean |
Logical; if |
mean_color |
Character string; hex code or color name for group mean indicators. Default is |
color_palette |
Character string; a valid |
A list containing:
ANOVA_Summary |
Global ANOVA summary table with interaction terms. |
TukeyHSD |
Tukey HSD pairwise comparison results across interaction levels. |
EMMs |
Estimated Marginal Means object from |
Summary_Table |
Aggregated sample sizes, means, SDs, SEs, and confidence limits. |
Plot |
The publication-ready |