| Type: | Package |
| Title: | Automated Statistical Analysis, Visualization and Multi-Format Narrative Reporting |
| Version: | 2.0.0 |
| Date: | 2026-04-28 |
| Description: | Provides automated statistical analysis, rich visualization, and multi-format narrative reporting through a unified pipeline. Descriptive statistics are available via easy_describe() and easy_group_summary(). Inferential tests with plain-language narratives are provided by easy_regression(), easy_logistic_regression(), easy_ttest(), easy_anova(), easy_chisq(), easy_ztest(), easy_ftest(), easy_correlation(), easy_wilcox(), and easy_kruskal(). Publication-ready 'ggplot2' visualizations are produced by easy_histogram(), easy_boxplot(), easy_scatter(), easy_barplot(), easy_qqplot(), easy_density(), easy_correlation_heatmap(), easy_regression_diagnostics(), and easy_odds_ratio_plot(). The core Narrative Generator Module applies conditional logic to extracted p-values, effect sizes, and model-fit metrics to produce statistically sound, human-readable explanations automatically. Results render in the 'RStudio' Viewer (HTML), the console (ASCII), or export directly to Microsoft Word via 'flextable' and 'officer'. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Language: | en-US |
| Depends: | R (≥ 4.1.0) |
| RoxygenNote: | 7.3.3 |
| Imports: | broom (≥ 1.0.0), glue (≥ 1.6.0), ggplot2 (≥ 3.4.0), knitr (≥ 1.40), kableExtra (≥ 1.3.4), htmltools (≥ 0.5.0), flextable (≥ 0.9.0), officer (≥ 0.6.0), stats, utils, tools |
| Suggests: | testthat (≥ 3.0.0), scales (≥ 1.2.0), rmarkdown (≥ 2.0) |
| VignetteBuilder: | knitr |
| URL: | https://github.com/itsmdivakaran/Easystat, https://itsmdivakaran.github.io/Easystat/ |
| BugReports: | https://github.com/itsmdivakaran/Easystat/issues |
| NeedsCompilation: | no |
| Packaged: | 2026-04-29 08:21:54 UTC; maheshdivakaran |
| Author: | Mahesh Divakaran [aut, cre] (Affiliation: Amity School of Applied Sciences, Amity University Lucknow), Gunjan Singh [aut] (Affiliation: Amity School of Applied Sciences, Amity University Lucknow), Jayadevan Shreedharan [aut] (Affiliation: Gulf Medical University) |
| Maintainer: | Mahesh Divakaran <imaheshdivakaran@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-04-29 19:10:14 UTC |
EasyStat: Automated Statistical Analysis, Visualization and Multi-Format Narrative Reporting
Description
EasyStat provides a unified pipeline for automated statistical analysis and plain-language narrative reporting in R. The four-step pipeline — Core Statistical Engine, Metric Extractor (broom), Narrative Generator Module, and Unified Result Object — transforms raw data into publication-ready output with a single function call.
Descriptive statistics:
easy_describe, easy_group_summary
Inferential tests:
easy_regression, easy_ttest,
easy_anova, easy_chisq,
easy_ztest, easy_ftest,
easy_correlation
Visualizations:
easy_histogram, easy_boxplot,
easy_scatter, easy_barplot,
easy_qqplot, easy_density,
easy_correlation_heatmap, easy_autoplot
Reporting:
export_to_word, theme_easystat
Authors
Mahesh Divakaran (Amity School of Applied Sciences, Amity University Lucknow), Gunjan Singh (Amity School of Applied Sciences, Amity University Lucknow), Jayadevan Shreedharan (Gulf Medical University)
Author(s)
Maintainer: Mahesh Divakaran imaheshdivakaran@gmail.com (Amity School of Applied Sciences, Amity University Lucknow)
Authors:
Gunjan Singh (Amity School of Applied Sciences, Amity University Lucknow)
Jayadevan Shreedharan (Gulf Medical University)
See Also
Useful links:
Report bugs at https://github.com/itsmdivakaran/Easystat/issues
Run a One-Way ANOVA with Automated Narrative Reporting
Description
Executes a one-way ANOVA using stats::aov(), extracts key metrics
via broom, computes eta-squared as an effect-size measure, and
generates a plain-language narrative via the Narrative Generator Module.
Usage
easy_anova(formula, data, alpha = 0.05)
Arguments
formula |
A |
data |
A data frame containing the variables in |
alpha |
Significance threshold for the narrative. Default |
Value
An object of class "easystat_result" with:
test_typeCharacter:
"anova"formula_strCharacter string of the formula used
raw_modelThe raw
aovobjectcoefficients_tableANOVA table (SS, df, MS, F, p)
model_fit_tableSummary metrics (F-statistic, eta-squared, p-value)
explanationPlain-language narrative string
Examples
result <- easy_anova(Sepal.Length ~ Species, data = iris)
print(result)
Automatically Plot an EasyStat Result
Description
Chooses the most appropriate plot type based on the test_type of an
easystat_result object and renders it.
Usage
easy_autoplot(result, data = NULL, ...)
Arguments
result |
An |
data |
The original data frame (required for some plot types). |
... |
Additional arguments passed to the underlying plot function. |
Value
An "easystat_result" plot object, invisibly.
Annotated Bar Chart
Description
Creates a frequency bar chart for categorical variables, or a mean-and-error bar chart for numeric outcomes grouped by a factor.
Usage
easy_barplot(
x,
data,
group_by = NULL,
stat = c("count", "mean"),
fill_palette = NULL,
title = NULL
)
Arguments
x |
Column name of the variable to plot. |
data |
A data frame. |
group_by |
Optional grouping column for grouped frequency bars. |
stat |
|
fill_palette |
Color palette vector. Default EasyStat palette. |
title |
Custom plot title. |
Value
An "easystat_result" object with plot_object.
Grouped Boxplot with Outlier Detection
Description
Produces a boxplot for one variable, optionally grouped by a factor. Adds a jittered dot overlay, labels each group's median, and highlights outliers.
Usage
easy_boxplot(formula, data, fill_palette = NULL, notch = FALSE, title = NULL)
Arguments
formula |
A formula: |
data |
A data frame. |
fill_palette |
Character vector of fill colors. Default EasyStat palette. |
notch |
Logical; draw notched boxes? Default |
title |
Custom plot title. |
Value
An "easystat_result" object with plot_object.
Chi-Square Tests with Automated Narrative Reporting
Description
Runs either a chi-square test of independence (two categorical variables) or a goodness-of-fit test (one variable vs. expected proportions), extracts Cramér's V as the effect-size measure, and generates a plain-language narrative via the Narrative Generator Module.
Usage
easy_chisq(x, y = NULL, data = NULL, p = NULL, correct = TRUE, alpha = 0.05)
Arguments
x |
A factor/character vector, OR a contingency table (matrix), OR a
formula |
y |
A factor/character vector (second categorical variable) for the
independence test. Ignored when |
data |
A data frame. Required when |
p |
Numeric vector of expected probabilities for the GOF test.
If |
correct |
Logical; apply Yates' continuity correction? Default |
alpha |
Significance threshold for narrative. Default |
Value
An "easystat_result" object with:
coefficients_tableObserved vs. expected frequency table
model_fit_tableChi-square statistic, df, p-value, Cramér's V
explanationPlain-language narrative
Examples
# Independence test
result <- easy_chisq(~ cyl + am, data = mtcars)
print(result)
# Goodness-of-fit
result <- easy_chisq(~ cyl, data = mtcars)
print(result)
Correlation Analysis with Automated Narrative Reporting
Description
Computes bivariate or pairwise correlations (Pearson, Spearman, or Kendall) with significance tests and confidence intervals. For two variables a full narrative is generated; for multiple variables a correlation matrix is returned with a summary digest.
Usage
easy_correlation(
x,
y = NULL,
data = NULL,
vars = NULL,
method = "pearson",
conf_level = 0.95,
alpha = 0.05
)
Arguments
x |
A numeric vector, a data frame, OR a formula |
y |
A numeric vector (paired with |
data |
A data frame. Required when |
vars |
Character vector of column names when |
method |
Correlation method: |
conf_level |
Confidence level for Pearson CI. Default |
alpha |
Significance threshold for narrative. Default |
Value
An "easystat_result" object.
Examples
result <- easy_correlation(~ mpg + wt, data = mtcars)
print(result)
result <- easy_correlation(mtcars, vars = c("mpg", "hp", "wt", "disp"))
print(result)
Correlation Matrix Heatmap
Description
Computes pairwise correlations and displays them as a color-coded heatmap, annotating each cell with the correlation coefficient and a significance star.
Usage
easy_correlation_heatmap(data, vars = NULL, method = "pearson", title = NULL)
Arguments
data |
A data frame. |
vars |
Character vector of numeric column names. Default all numerics. |
method |
Correlation method: |
title |
Custom plot title. |
Value
An "easystat_result" object with plot_object.
Kernel Density Plot with Optional Group Overlay
Description
Draws a smooth kernel density estimate for a numeric variable. If a grouping variable is provided, separate overlapping density curves are drawn per group.
Usage
easy_density(x, data = NULL, group_by = NULL, fill_alpha = 0.35, title = NULL)
Arguments
x |
Column name or numeric vector. |
data |
A data frame. |
group_by |
Optional grouping column for multi-group densities. |
fill_alpha |
Alpha for filled area. Default |
title |
Custom plot title. |
Value
An "easystat_result" object with plot_object.
Comprehensive Descriptive Statistics with Narrative
Description
Computes a rich set of descriptive statistics for one or more numeric variables, including measures of central tendency, dispersion, shape (skewness, kurtosis), and normality (Shapiro-Wilk), together with an automatic plain-language narrative interpretation.
Usage
easy_describe(data, vars = NULL, digits = 4, conf_level = 0.95)
Arguments
data |
A numeric vector or a data frame. |
vars |
Character vector of column names to describe when |
digits |
Number of decimal places in the summary table. Default |
conf_level |
Confidence level for the mean CI. Default |
Value
An "easystat_result" object with:
coefficients_tableWide-format summary statistics table
model_fit_tableShape and normality digest
explanationPlain-language narrative (one per variable)
Examples
result <- easy_describe(mtcars, vars = c("mpg", "hp", "wt"))
print(result)
F-Test for Equality of Variances with Automated Narrative Reporting
Description
Performs an F-test to compare the variances of two independent groups using
stats::var.test(), extracts the F-statistic, degrees of freedom,
p-value, variance ratio, and confidence interval, and generates a
plain-language narrative that includes a practical recommendation for
downstream t-test selection (equal vs. unequal variances).
Usage
easy_ftest(
x,
y = NULL,
data = NULL,
ratio = 1,
alternative = "two.sided",
conf_level = 0.95,
alpha = 0.05
)
Arguments
x |
A numeric vector (Group 1), OR a formula |
y |
A numeric vector (Group 2). Ignored when |
data |
A data frame. Required when |
ratio |
Hypothesized ratio of variances under H0. Default |
alternative |
|
conf_level |
Confidence level for the variance ratio CI. Default |
alpha |
Significance threshold for narrative. Default |
Value
An "easystat_result" object.
Examples
result <- easy_ftest(mpg ~ am, data = mtcars)
print(result)
Group-Wise Summary Statistics with Narrative
Description
Computes descriptive statistics for a numeric outcome variable stratified by a grouping factor, providing both a comparison table and a narrative highlighting which group has the highest/lowest mean and variability.
Usage
easy_group_summary(formula, data, digits = 4)
Arguments
formula |
A formula of the form |
data |
A data frame containing the variables. |
digits |
Number of decimal places. Default |
Value
An "easystat_result" object.
Examples
result <- easy_group_summary(mpg ~ cyl, data = mtcars)
print(result)
Annotated Histogram with Normal Curve Overlay
Description
Draws a histogram of a numeric variable, overlays a fitted normal density curve, and annotates the plot with the mean, median, and standard deviation. Normality is assessed via the Shapiro-Wilk test, and the result is displayed in the subtitle.
Usage
easy_histogram(
x,
data = NULL,
bins = NULL,
fill_color = NULL,
show_normal = TRUE,
title = NULL
)
Arguments
x |
Character column name OR a numeric vector. |
data |
A data frame (required when |
bins |
Number of histogram bins. Default |
fill_color |
Bar fill color. Default EasyStat primary blue. |
show_normal |
Logical; overlay normal curve? Default |
title |
Custom plot title. Default auto-generated. |
Value
An "easystat_result" object with plot_object.
Kruskal-Wallis Test with Automated Narrative Reporting
Description
Runs a Kruskal-Wallis rank-sum test for comparing three or more groups.
Usage
easy_kruskal(formula, data, alpha = 0.05)
Arguments
formula |
A formula of the form |
data |
A data frame. |
alpha |
Significance threshold for narrative. Default |
Value
An "easystat_result" object.
Examples
result <- easy_kruskal(Sepal.Length ~ Species, data = iris)
print(result)
Run a Logistic Regression with Automated Narrative Reporting
Description
Executes a binary logistic regression using stats::glm() with
family = binomial, extracts coefficients, odds ratios, approximate
confidence intervals, and model-fit metrics, then generates a plain-language
narrative via the Narrative Generator Module.
Usage
easy_logistic_regression(formula, data, alpha = 0.05, conf_level = 0.95)
Arguments
formula |
A |
data |
A data frame containing the variables referenced in |
alpha |
Significance threshold used in narrative generation. Default |
conf_level |
Confidence level for odds-ratio intervals. Default |
Value
An object of class "easystat_result" with coefficient, odds-ratio,
model-fit, raw glm, and narrative components.
Examples
result <- easy_logistic_regression(am ~ mpg + wt, data = mtcars)
print(result)
Odds Ratio Plot for Logistic Regression
Description
Creates a coefficient figure showing odds ratios and confidence intervals
for easy_logistic_regression results.
Usage
easy_odds_ratio_plot(result)
Arguments
result |
An |
Value
An "easystat_result" object with plot_object.
Normal Q-Q Plot with Shapiro-Wilk Annotation
Description
Plots sample quantiles against theoretical normal quantiles and annotates the Shapiro-Wilk p-value. Deviations from the diagonal indicate non-normality.
Usage
easy_qqplot(x, data = NULL, title = NULL)
Arguments
x |
Column name or numeric vector. |
data |
A data frame (required when |
title |
Custom plot title. |
Value
An "easystat_result" object with plot_object.
Run a Linear Regression with Automated Narrative Reporting
Description
Executes a standard OLS linear regression using stats::lm(), extracts
key metrics via the broom package, and automatically generates a
plain-language narrative explanation via the Narrative Generator Module.
Usage
easy_regression(formula, data, alpha = 0.05)
Arguments
formula |
A |
data |
A data frame containing the variables referenced in |
alpha |
Significance threshold used in narrative generation. Default |
Value
An object of class "easystat_result" (an R list) with:
test_typeCharacter:
"regression"formula_strCharacter string of the formula used
raw_modelThe raw
lmobject for advanced usecoefficients_tableTidy data frame of coefficients, SEs, t-stats, p-values
model_fit_tableData frame with R
^2, Adjusted R^2, F-statistic, p-valueexplanationPlain-language narrative string
Examples
result <- easy_regression(mpg ~ wt + hp, data = mtcars)
print(result)
Regression Diagnostic Plot
Description
Creates a fitted-vs-residuals diagnostic figure for linear regression
results returned by easy_regression.
Usage
easy_regression_diagnostics(result)
Arguments
result |
An |
Value
An "easystat_result" object with plot_object.
Scatter Plot with Regression Line and Correlation Annotation
Description
Draws a scatter plot for two numeric variables, overlays a linear regression line with confidence band, and annotates the Pearson r and p-value.
Usage
easy_scatter(
formula,
data,
color_by = NULL,
smooth = TRUE,
ellipse = TRUE,
title = NULL
)
Arguments
formula |
A formula: |
data |
A data frame. |
color_by |
Optional column name to color points by a third variable. |
smooth |
Logical; show regression line? Default |
ellipse |
Logical; draw a 95% data ellipse? Default |
title |
Custom plot title. |
Value
An "easystat_result" object with plot_object.
Run an Independent-Samples t-Test with Automated Narrative Reporting
Description
Executes a two-sample (or one-sample) t-test using stats::t.test(),
extracts key metrics via broom, and generates a plain-language
narrative via the Narrative Generator Module.
Usage
easy_ttest(
x,
y = NULL,
data = NULL,
mu = 0,
var.equal = FALSE,
conf.level = 0.95,
alpha = 0.05
)
Arguments
x |
A numeric vector, OR a formula of the form |
y |
A numeric vector (second group) when |
data |
A data frame. Required when |
mu |
Null hypothesis value for the mean (one-sample test). Default |
var.equal |
Logical; assume equal variances? Default |
conf.level |
Confidence level. Default |
alpha |
Significance threshold for narrative. Default |
Value
An object of class "easystat_result" with:
test_typeCharacter:
"ttest"formula_strDescription of the comparison
raw_modelThe raw
htestobjectcoefficients_tableGroup means and confidence interval
model_fit_tablet-statistic, df, and p-value
explanationPlain-language narrative string
Examples
result <- easy_ttest(mpg ~ am, data = mtcars)
print(result)
Wilcoxon Tests with Automated Narrative Reporting
Description
Runs a one-sample, paired, or two-sample Wilcoxon test using
stats::wilcox.test() and returns an "easystat_result" object.
Usage
easy_wilcox(
x,
y = NULL,
data = NULL,
mu = 0,
paired = FALSE,
alternative = "two.sided",
conf_level = 0.95,
alpha = 0.05
)
Arguments
x |
Numeric vector, or a formula of the form |
y |
Optional numeric vector for paired or two-sample tests. |
data |
Data frame used when |
mu |
Null hypothesized location or location shift. Default |
paired |
Logical. Use paired test? Default |
alternative |
|
conf_level |
Confidence level. Default |
alpha |
Significance threshold for narrative. Default |
Value
An "easystat_result" object.
Examples
result <- easy_wilcox(mpg ~ am, data = mtcars)
print(result)
One-Sample and Two-Sample Z-Tests with Automated Narrative Reporting
Description
Performs a z-test using the normal distribution. When the population
standard deviation (sigma) is not provided, the sample SD is used
(valid for large samples, n \geq 30, by the Central Limit Theorem).
Key metrics — z-statistic, p-value, confidence interval, and Cohen's d —
are extracted and fed to the Narrative Generator Module.
Usage
easy_ztest(
x,
y = NULL,
data = NULL,
mu = 0,
sigma = NULL,
sigma2 = NULL,
alternative = "two.sided",
conf_level = 0.95,
alpha = 0.05
)
Arguments
x |
A numeric vector (Group 1), OR a formula |
y |
A numeric vector (Group 2) for a two-sample test. Ignored when
|
data |
A data frame. Required when |
mu |
Hypothesized population mean (one-sample) or mean difference
(two-sample). Default |
sigma |
Known population SD for Group 1 (or the single group).
If |
sigma2 |
Known population SD for Group 2. If |
alternative |
|
conf_level |
Confidence level. Default |
alpha |
Significance threshold for narrative. Default |
Value
An "easystat_result" object.
Examples
# One-sample z-test (large n, CLT)
result <- easy_ztest(mtcars$mpg, mu = 20)
print(result)
# Two-sample z-test via formula
result <- easy_ztest(mpg ~ am, data = mtcars)
print(result)
Export an EasyStat Result to a Formatted Microsoft Word Document
Description
Takes a unified easystat_result object and writes a fully formatted
.docx report using the flextable and officer packages.
The report contains a title page header, the plain-language narrative,
both statistical tables rendered as professional flextable objects,
and a footer with metadata. All of this is produced in a single function call.
Usage
export_to_word(result, file, title = NULL, author = "EasyStat")
Arguments
result |
An object of class |
file |
Character string. Path to the output |
title |
Character string. Report title printed at the top of the
document. If |
author |
Character string. Author name(s) for the report header.
Default |
Value
The file path invisibly (a length-one character vector). The
.docx file is written to the path supplied via file as a
side-effect.
Examples
result <- easy_regression(mpg ~ wt + hp, data = mtcars)
export_to_word(result, file = tempfile(fileext = ".docx"),
author = "Mr. Mahesh Divakaran")
Print an EasyStat Result Object
Description
Automatically renders an easystat_result object. In an interactive
RStudio session the HTML Viewer is used; otherwise clean ASCII tables and
the plain-language narrative are written to the console.
Usage
## S3 method for class 'easystat_result'
print(x, viewer = NULL, ...)
Arguments
x |
An object of class |
viewer |
Logical. Force HTML Viewer output ( |
... |
Currently ignored. |
Value
x invisibly.
Summarize an EasyStat Result Object
Description
Summarize an EasyStat Result Object
Usage
## S3 method for class 'easystat_result'
summary(object, ...)
Arguments
object |
An |
... |
Passed to |
Value
Called for its side effects (printing to the console or RStudio
Viewer). Returns object invisibly via
print.easystat_result.
Apply EasyStat ggplot2 Theme
Description
Adds a clean, professional EasyStat visual theme to any ggplot2 object.
Usage
theme_easystat(base_size = 12, legend_position = "right")
Arguments
base_size |
Base font size. Default |
legend_position |
Where to place the legend. Default |
Value
A ggplot2::theme object.