Data Visualization and Statistical Tools for Agroindustrial Experiments
Overview
Set of tools for statistical analysis, visualization, and reporting of agroindustrial and agricultural experiments. The package provides functions to perform one-way and two-way ANOVA with post-hoc tests (Tukey HSD and Duncan MRT), Welch ANOVA for heteroscedastic data, and the Games-Howell post-hoc test as a robust alternative when variance homogeneity fails. When residual normality fails, the Kruskal-Wallis test (with 'agricolae' or Dunn post-hoc letters) or, for blocked designs, the Friedman test is used, so that letters are always obtained through a defensible route. Normality of residuals is assessed with the Shapiro-Wilk test and homoscedasticity with the Fligner-Killeen test; the appropriate statistical path is selected automatically based on these diagnostics. Coefficients of variation and statistical power (via one-way ANOVA power analysis) are reported alongside the post-hoc letter display, and each figure includes a note describing the statistical route used, its rationale, advantages, limitations and scope. High-level wrappers allow automated multi-variable analysis with optional clustering by one or two experimental factors, with support for custom level ordering and relabeling. Results are returned as 'ggplot2' boxplots with mean and letter annotations, wide-format summary tables ready for publication or LaTeX rendering, and structured decision summaries for rapid agronomic interpretation. Direct export to Excel spreadsheets and high-resolution image tables is also supported. Functions follow methods widely used in agronomy, field trials, and plant breeding. Key references: Tukey (1949) doi:10.2307/3001913; Duncan (1955) doi:10.2307/3001478; Welch (1951) doi:10.2307/2332579; Games and Howell (1976) doi:10.2307/2529858; Shapiro and Wilk (1965) doi:10.2307/2333709; Fligner and Killeen (1976) doi:10.2307/2529096; Kruskal and Wallis (1952) doi:10.1080/01621459.1952.10483441; Dunn (1964) doi:10.1080/00401706.1964.10490181; Friedman (1937) doi:10.1080/01621459.1937.10503522; Cohen (1988, ISBN:9781138892899); Wickham (2016, ISBN:9783319242750) for 'ggplot2'; see also 'agricolae' https://CRAN.R-project.org/package=agricolae and 'rstatix' https://CRAN.R-project.org/package=rstatix. Version en espanol: Conjunto de herramientas para el analisis estadistico, visualizacion y generacion de reportes en ensayos agroindustriales y agricolas. Incluye ANOVA univariado y bifactorial con pruebas post-hoc (Tukey HSD y Duncan MRT), ANOVA de Welch para datos heterocedasticos y la prueba post-hoc de Games-Howell como alternativa robusta cuando falla la homogeneidad de varianzas. Cuando falla la normalidad de residuos se usa la prueba de Kruskal-Wallis (con letras de 'agricolae' o de Dunn) o, en disenos en bloques, la prueba de Friedman, de modo que las letras se obtienen siempre por una ruta defendible. La normalidad de residuos se evalua con la prueba de Shapiro-Wilk y la homogeneidad de varianzas con la prueba de Fligner-Killeen; la ruta estadistica apropiada se selecciona automaticamente segun estos diagnosticos. Se reportan coeficientes de variacion y potencia estadistica junto con las letras de separacion de medias, y cada grafico incluye una nota que describe la ruta estadistica usada, por que, sus ventajas, desventajas y alcance. Los envoltorios de alto nivel permiten analisis multivariable automatizado con agrupamiento opcional por uno o dos factores experimentales, con soporte para orden y etiquetado personalizado de niveles. Los resultados se devuelven como boxplots con anotaciones de medias y letras, tablas resumen en formato ancho listas para publicacion o renderizado en LaTeX, y resumenes de decision para interpretacion agronomica rapida. Tambien se soporta exportacion directa a Excel e imagenes de alta resolucion para informes tecnicos.
New features
- New automatic route selection in
agrobox(). The goal is to place post-hoc letters through a viable and defensible statistical route. For each cluster the function checks sufficient data, Shapiro-Wilk (residual normality) and Fligner-Killeen (homogeneity of variances), and then selects: - **Route A** (normal + homogeneous): ANOVA + Duncan / Tukey (block and
factor2included in the model). - **Route B** (normal + heteroscedastic): Welch ANOVA + Games-Howell.
- **Route C** (not normal + homogeneous): Kruskal-Wallis, or Friedman when a block is present.
- **Route D** (not normal + heteroscedastic): same tests as route C, flagged with a note on heterogeneous variances.
Show all changes in 0.4.0Hide the rest of the changes in 0.4.0
- Added non-parametric analysis:
- Kruskal-Wallis with letters from
agricolae::kruskal()or Dunn post-hoc test, selected with the new argumentnp_test = c("kruskal", "dunn"). - Friedman test for blocked designs (RCBD). Replicates per treatment x block are averaged and incomplete blocks are excluded. Letters are protected by the global Friedman test (all treatments share "a" when it is not significant).
- New argument
p.adj(default"bonferroni") for p-value adjustment in Kruskal-Wallis and Dunn comparisons. - Fallback chain: if the post-hoc test of the selected route cannot be computed, the next viable route is tried (A/B -> non-parametric, Friedman -> Kruskal-Wallis, Kruskal-Wallis <-> Dunn). Means without letters are shown only as a last resort, always with an explicit note.
- Each
agrobox()figure now includes a method note (caption) describing the route used in each panel: why it was selected, its advantages, limitations and scope. It can be removed with+ ggplot2::labs(caption = NULL). - Route B now computes the Welch ANOVA p-value (
oneway.test()). - New columns in
$stats:ruta,metodo,p_ruta(p-value of the global test used by the route) andnota. - Added
agroppt()to export a ggplot figure to a single editable PowerPoint slide (vector graphic), with custom width and height.
Bug fixes
- Games-Howell letters were relabeled as whole strings, so a group such as "ab" became a new letter and produced wrong groupings. Letters are now relabeled letter by letter.
- Games-Howell failed silently when
bloqueorfactor2were supplied (letters disappeared). It now compares treatments only and adds a note. agrobox()failed with *could not find function "%>%"* whendplyrwas not loaded.%>%and.dataare now imported.estructura = "row~"(documented) produced a parsing error infacet_grid(); it is now completed internally as"row ~ .".- Group labels containing
"_"(or non-ASCII characters in non-UTF-8 sessions) sent means and letters to an extraNApanel. Grouping columns are now recovered by joining on the cluster instead of splitting its label. - Negative responses: the automatic upper y-axis limit fell below the maximum and removed observations; the CV was reported as negative. The CV now uses the absolute value of the mean.
- Manual
lim_sup/lim_infremoved observations outside the range and altered the boxplots. Limits now usecoord_cartesian()(zoom only). - Statistical power was underestimated with blocks or
factor2; it now uses partial eta squared (identical results in one-way models). - Numeric levels (e.g. doses 0, 50, 100, 150) were ordered as text; they are now ordered numerically, and factor levels are respected.
$tablacolumns and$statsrows now follow the facet order defined bygrupo1_orden/grupo2_orden.- Empty cells are shown instead of
NAin$tablawhen treatments are nested within groups. - LaTeX
\makecellheaders in$tablano longer split labels that contain"_".
Improvements
- A message now lists factor levels that are excluded because they are not included in
orden_factor,grupo1_ordenorgrupo2_orden. - CV and Power are reported in every route (computed from the classic ANOVA fit).
- The
ANOVArow of$tablashows significance stars only for route A; other routes show"-". - Example 5 of
agrobox()wrapped in\donttest{}to keep example run time within CRAN limits.
Deprecated
var.equalno longer changes the results: the route is selected automatically. The argument is kept for backward compatibility and a message is shown when it is supplied.
Changes in results compared with 0.3.0
- Panels that previously showed means without letters (e.g. failed normality) now receive letters through routes B, C or D.
- Games-Howell letters may differ where groups overlap (bug fix above).
- Statistical power changes in models with block or
factor2. - Route A results (means, letters, ANOVA, CV) are unchanged.
Dependencies
- Added
officerandrvgto Suggests (only required byagroppt()).
---
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-08
- ERROR12 OK, 1 ERROR2026-09-07
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
Show 2 earlier changesHide 2 earlier changes
- ERROR12 OK, 1 ERROR2026-06-08
- OK14 OK2026-03-10
Documentation
- Help pages
- 7
- Examples that run
- 50%2 run in a plain check (1 of them under a condition) · 2 never run
- Exported functions with examples
- 80%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
6 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/joa3aquin50/agrobox on 2026-10-22.
Show all practicesHide 1 practice
Dependencies
Code & Tests
Datasets
People & History
Package metadata
- First published
- 2025-11-19
- Total releases
- 5 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 7.0 KB / 2 files
- Download size
- 51 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("agrobox")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.