Correspondence Analysis Biplots and Diagnostic Reports

A convenience wrapper around 'FactoMineR' and 'factoextra' for running Correspondence Analysis (CA) on a numeric data table (e.g. a genotype-by-trait or contingency-style matrix) and producing a full set of publication-ready diagnostic plots: scree plot, symmetric biplot, row-only and column-only plots, row/column contribution plots, and row/column cos2 (quality-of-representation) plots. A single top-level function runs the whole pipeline, prints formatted result tables, and optionally saves every plot as a high-resolution image, mirroring a typical CA reporting workflow used in agronomy and plant-breeding studies. An example genotype-by-trait data set is included.


CAbiplot

CAbiplot is an R package that wraps FactoMineR and factoextra into a single, reusable pipeline for Correspondence Analysis (CA). It reproduces (as package functions) the full set of diagnostic plots from a typical CA reporting script: a scree plot, a symmetric biplot, row-only and column-only plots, row/column contribution plots, and row/column cos2 plots — plus a combined summary figure.

An example genotype-by-trait data set (19 genotypes x 6 traits) is bundled with the package.

Installation

Install the required dependencies, then install the package from source:

install.packages(c("FactoMineR", "factoextra", "ggplot2", "gridExtra"))

# From a local source tree / tarball:
install.packages("path/to/CAbiplot", repos = NULL, type = "source")

# Or, with devtools, from the unpacked package directory:
# devtools::install("path/to/CAbiplot")

Quick start

library(CAbiplot)

# Load the bundled example data (or use your own numeric matrix / data.frame
# / path to a CSV file with row names in the first column)
geno <- get_genotype_traits()

# Run the whole pipeline: fits CA, builds every plot, prints result tables,
# and saves each plot as a high-resolution JPEG in the given directory
report <- ca_report(geno, output_dir = "ca_output", prefix = "CA")

# Everything is also returned for interactive use:
report$res.ca            # the fitted FactoMineR::CA object
report$eig                # eigenvalue / inertia table
report$plots$biplot       # the symmetric biplot (ggplot object)
report$plots$combined     # the combined summary figure

Prefer to build plots one at a time, or on a CA object you already computed yourself?

res.ca <- run_ca(geno)

ca_scree_plot(res.ca)
ca_biplot(res.ca)
ca_row_plot(res.ca)
ca_col_plot(res.ca)
ca_contrib_plot(res.ca, choice = "row", axes = 1)
ca_contrib_plot(res.ca, choice = "col", axes = 2)
ca_cos2_plot(res.ca, choice = "row")
ca_cos2_plot(res.ca, choice = "col")

Functions

Function Description
read_ca_data() Read a delimited file into a numeric CA-ready data.frame
get_genotype_traits() Load the bundled example genotype-by-trait data set
run_ca() Run FactoMineR::CA() on a matrix/data.frame/file path
ca_scree_plot() Eigenvalue scree plot
ca_biplot() Symmetric row + column biplot
ca_row_plot() Row-only plot
ca_col_plot() Column-only plot
ca_contrib_plot() Row or column contribution plot for chosen dimension(s)
ca_cos2_plot() Row or column cos2 (quality of representation) plot
ca_report() Full pipeline: fit, plot everything, save, print tables

Tests

Run the test suite with:

devtools::test()
# or
testthat::test_dir("tests/testthat")

License

MIT

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("CAbiplot")

0.1.0 by Prakash Kumar, 23 days ago


Browse source code at https://github.com/cran/CAbiplot


Authors: Prakash Kumar [aut, cre] , Himadri Sekhar Roy [aut] , Ranjit Kumar Paul [aut] , Md. Yeasin [aut] , Sunil Kumar Yadav [aut] , Amrit Kumar Paul [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports FactoMineR, factoextra, ggplot2, gridExtra, utils

Suggests testthat


See at CRAN