| Type: | Package |
| Title: | Robust Ecological and Fisheries Data Analysis and Visualization |
| Version: | 1.2.2 |
| 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>. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/Ataher76/aquats, https://doi.org/10.5281/zenodo.22885025 |
| BugReports: | https://github.com/Ataher76/aquats/issues |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.2 |
| Depends: | R (≥ 3.5.0) |
| Imports: | dplyr, emmeans, ggplot2, ggpubr, ggrepel, MASS, multcomp, RColorBrewer, rlang, tidyr, ggalluvial, vegan |
| Suggests: | cowplot, knitr, multcompView, patchwork, readxl, rmarkdown, writexl |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-10-11 05:34:56 UTC; User |
| Author: | Ataher Ali |
| Maintainer: | Ataher Ali <ataher.cu.ms@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-10-21 15:00:12 UTC |
Analysis of Covariance (ANCOVA) with Adjusted Means Visualization
Description
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.
Usage
ancova_analysis(
data,
response_var,
factor_var,
covariate_var,
factor_levels = NULL,
facet = FALSE,
color_palette = "Set1"
)
Arguments
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 |
Value
A list containing:
ANCOVA_Table |
Analysis of variance table ( |
EMMs |
Estimated marginal means summary object from |
Plot |
The publication-ready |
Calculate Comprehensive Alpha Diversity Indices
Description
Computes species richness, total abundance, Shannon-Wiener (H'),
Gini-Simpson (1 - D), Margalef (d), Menhinick (R),
and Pielou's evenness (J') 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.
Usage
calc_diversity(data, group_col = NULL)
Arguments
data |
A |
group_col |
Optional character or integer vector; column name(s) or index/indices
in |
Value
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 ( |
Heavy Metal Pollution Indices with Confidence Intervals
Description
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.
Usage
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
)
Arguments
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 ( |
Value
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). |
Weighted Arithmetic Water Quality Index (WAWQI) with Confidence Intervals
Description
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.
Usage
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
)
Arguments
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
( |
Value
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). |
Hierarchical Clustering Dendrogram for Aquatic Communities
Description
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.
Usage
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
)
Arguments
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 |
Value
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. |
Multi-Trophic Community Abundance Master List
Description
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.
Usage
community_master
Format
A named list with 3 data frames:
- Phytoplankton
Data frame of diatom, cyanobacteria, and green algae counts.
- Zooplankton
Data frame of copepod, cladoceran, and rotifer counts.
- Benthos
Data frame of chironomid, oligochaete, and mollusc counts.
Two-Sample Comparison with Automated F-Test, t-Test, and Visualization
Description
Evaluates equality of variances using Fisher's F-test, checks group-level
normality via the Shapiro-Wilk test, and performs Student's, Welch's, or paired
t-test to compare means between two groups. Automatically computes effect sizes
(Cohen's d), compiles group descriptive statistics, and generates a
publication-ready ggplot2 graphic with significance annotations.
Usage
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
)
Arguments
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 |
Value
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 ( |
Flexible Correlation Matrix and Heatmap Generator for Environmental Data
Description
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.
Usage
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
)
Arguments
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 |
Value
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 |
Distance-based Redundancy Analysis (db-RDA) Triplot
Description
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.
Usage
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
)
Arguments
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 |
Value
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 |
Generalized Linear Modeling (GLM) for Aquatic and Ecological Data
Description
Fits generalized linear models (GLM) across Gaussian, Poisson, Binomial, and Gamma families with publication-ready diagnostic and prediction graphics.
Usage
glm_analysis(
data,
response_var,
predictor_vars,
family_type = "poisson",
color_palette = "Set1"
)
Arguments
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 |
Value
A list containing:
Model |
The fitted |
Summary |
Summary specification of the fitted model ( |
Anova_Table |
Analysis of deviance table ( |
Plot |
A publication-ready |
Comprehensive Master Dataset for Hilsa Shad Ecology and Statistics
Description
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.
Usage
hilsa_master
Format
A data frame with 120 rows and 14 variables:
- Habitat
Factor; sampling environment (Marine, Estuary, River).
- Season
Factor; fishing season (Monsoon, Dry).
- Size_Class
Factor; growth stage (Juvenile, Adult).
- Weight_g
Numeric; body weight in grams.
- Total_Length_cm
Numeric; total length in centimeters.
- Body_Depth_cm
Numeric; maximum body depth in centimeters.
- Head_Length_cm
Numeric; head length in centimeters.
- Fin_Length_cm
Numeric; pectoral fin length in centimeters.
- Fishing_Hours
Numeric; fishing effort in hours.
- Catch_Count
Integer; number of fish caught (count response).
- SST_C
Numeric; Sea Surface Temperature in degrees Celsius.
- Salinity_ppt
Numeric; water salinity in parts per thousand.
- Depth_m
Numeric; water depth in meters.
- Catch_kg
Numeric; total fish catch in kilograms.
Multivariate Analysis of Variance (MANOVA) with Alternative Visualizations
Description
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.
Usage
manova_analysis(
data,
response_vars,
factor_var,
factor_levels = NULL,
plot_type = "boxplot",
color_palette = "Set1"
)
Arguments
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 |
Value
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 |
Integrated Environmental Correlation and Multi-Community Mantel Network
Description
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.
Usage
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
)
Arguments
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 |
Value
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 |
Non-metric Multidimensional Scaling (NMDS) Analysis for Aquatic Communities
Description
Performs NMDS ordination with automated data transformations (Hellinger, log, etc.), stress quality checks, and generates a publication-ready ggplot2 scatterplot with 95
Usage
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
)
Arguments
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 |
Value
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 |
One-Way Analysis of Variance (ANOVA) with Faceting & Visualization
Description
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.
Usage
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"
)
Arguments
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 |
Value
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 |
Principal Component Analysis (PCA) Community Biplot
Description
Performs Principal Component Analysis (PCA / RDA) on aquatic community data. Generates a publication-ready ggplot2 biplot showing site coordinates with 95
Usage
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
)
Arguments
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 |
Value
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 |
PCA Correlation Circle with cos2 Gradient for Environmental Parameters
Description
Generates a publication-grade PCA correlation circle (variables factor map)
using base stats and ggplot2. Colors environmental parameters by their
representation quality (\cos^2) on the selected principal components.
Usage
pca_correlation_circle(
data,
exclude_cols = 1,
dim1 = 1,
dim2 = 2,
palette = c("#2A9D8F", "#E9C46A", "#F4A261", "#E76F51"),
title = NULL
)
Arguments
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 |
Value
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 |
Permutational Multivariate Analysis of Variance (PERMANOVA)
Description
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.
Usage
permanova_analysis(
data,
group_col = 1,
dist_method = "bray",
transform = c("none", "hellinger", "log", "pa", "wisconsin"),
permutations = 999,
seed = 42
)
Arguments
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 |
Value
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. |
Flexible and Batch Publication-Ready Bar and Lollipop Plots
Description
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.
Usage
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)
Arguments
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 |
Value
A single ggplot2 object, or a named list of ggplot2 objects
if batch plotting across multiple columns.
Publication-Grade Circular or Radial Bar Plot
Description
Builds circular bar charts with concentric reference gridlines, scale labels, and category labels. Best suited for data with six or more categories.
Usage
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
)
Arguments
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 |
Value
A publication-ready ggplot2 object.
Visualize and Test Alpha Diversity Patterns
Description
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.
Usage
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
)
Arguments
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 ( |
Value
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 |
Publication-Ready Single, Double, and Triple-Layered Donut Plots
Description
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.
Usage
plot_donut(
data,
levels,
value = NULL,
show_labels = TRUE,
min_percent = 4,
palette = "Set2",
title = NULL
)
Arguments
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 |
Value
A publication-ready ggplot2 object.
Publication-Ready Histogram and Density Plot
Description
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.
Usage
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
)
Arguments
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 |
Value
A publication-ready ggplot2 object.
Publication-Ready Likert Scale Visualization
Description
Generates modern diverging or 100% stacked horizontal bar charts for survey items and perception data.
Usage
plot_likert(
data,
items,
levels = NULL,
type = c("diverging", "stacked"),
palette = "RdYlBu",
show_labels = TRUE,
clean_labels = TRUE,
title = NULL
)
Arguments
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 |
Value
A publication-ready ggplot2 object.
Visualize Heavy Metal Pollution Indices with Confidence Intervals
Description
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.
Usage
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,
...
)
Arguments
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 |
Value
A publication-ready ggplot2 object.
Publication-Ready 3D Depth Pie Chart
Description
Generates an isometric 3D pie chart with perspective tilt, extruded
depth ribbons, and realistic shading natively in ggplot2.
Usage
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
)
Arguments
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 |
Value
A publication-ready ggplot2 object.
Publication-Ready Sankey and Alluvial Flow Diagram
Description
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.
Usage
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
)
Arguments
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 |
Value
A publication-ready ggplot2 alluvial diagram object.
Publication-Ready Temporal Tracking and Factorial Time-Series Plots
Description
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 \pm SE, SD, or 95
Usage
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
)
Arguments
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 |
Value
A list containing:
Plot |
The publication-ready |
Summary_Data |
A tidy data frame of aggregated Means, SDs, SEs, and Confidence Intervals. |
Visualize Water Quality Index (WQI) with Confidence Intervals
Description
Generates publication-ready WQI plots across monitoring stations with 95% confidence interval whiskers, status fills, and background benchmark bands for WAWQI classification tiers.
Usage
plot_wqi(
data,
id_col = "Station",
type = c("bar", "lollipop"),
show_ci = TRUE,
show_bands = TRUE,
title = NULL,
...
)
Arguments
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 |
Value
A publication-ready ggplot2 object.
Redundancy Analysis (RDA) Triplot
Description
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.
Usage
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
)
Arguments
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 |
Value
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 |
Parametric and Non-Linear Regression Analysis with Fitted Equations
Description
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.
Usage
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
)
Arguments
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 |
Value
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. |
Similarity Percentages (SIMPER) Analysis
Description
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.
Usage
simper_analysis(
data,
group_col = 1,
top_n = 5,
transform = c("none", "hellinger", "log", "pa", "wisconsin"),
permutations = 999,
seed = 42
)
Arguments
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 |
Value
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 |
Publication-Ready Species Accumulation Curves
Description
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.
Usage
specaccum_plot(
data,
group_col = 1,
by_group = FALSE,
method = "exact",
palette = "Set2",
line_color = "#2A9D8F",
ci = 1.96,
show_ci = TRUE,
title = NULL
)
Arguments
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 |
Value
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 |
Comprehensive Observation Summary with Excel Export
Description
Computes descriptive statistics (N, Mean, SD, SE, Median, Min, Max, and Mean \pm SD)
for numeric variables across optional grouping factors. Supports direct file
ingestion and exporting publication-ready tables directly to Excel (.xlsx) or CSV.
Usage
summarize_obs(data, vars = NULL, group = NULL, digits = 2, file = NULL)
Arguments
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 |
Value
A tidy data.frame containing computed descriptive metrics.
Examples
# 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)
Chi-Square Test of Independence and Goodness-of-Fit with Visualization
Description
Performs Pearson's Chi-Square (\chi^2) 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 V and
Phi coefficient \phi), extracts standardized Pearson residuals, and generates a
publication-ready ggplot2 stacked or dodged bar chart.
Usage
test_chisq(
data,
x,
y = NULL,
p = NULL,
correct = TRUE,
simulate_p = TRUE,
B = 2000,
plot_type = "stacked",
palette = "Set2",
title = NULL
)
Arguments
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 |
Value
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 |
Three-Way Analysis of Variance (ANOVA) with Faceted Interaction Visualization
Description
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.
Usage
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"
)
Arguments
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 |
Value
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 |
Two-Way Analysis of Variance (ANOVA) with Interaction & Faceting Visualization
Description
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.
Usage
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"
)
Arguments
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 |
Value
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 |