This package is currently experimental. This means that it is functional, but interfaces and functionalities may change over time, testing and documentation may be lacking.
Exploration and analysis of compositional data in the framework of J. Aitchison (1986). nexus provides tools for chemical fingerprinting and source tracking of ancient materials. This package provides methods for compositional data analysis:
transform_lr()
, transform_clr()
,
transform_alr()
, transform_ilr()
, transform_plr()
.detect_outlier()
.This package also includes methods for provenance studies:
pca()
.mix()
.isopleuros is a companion package to nexus that allows to create ternary plots.
To cite nexus in publications use:
Frerebeau N, Philippe A (2024). nexus: Sourcing Archaeological Materials by Chemical Composition. Université Bordeaux Montaigne, Pessac, France. https://doi.org/10.5281/zenodo.10225630, R package version 0.3.0, https://packages.tesselle.org/nexus/.
This package is a part of the tesselle project https://www.tesselle.org.
You can install the released version of nexus from CRAN with:
install.packages("nexus")
And the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("tesselle/nexus")
## Install extra packages (if needed)
# install.packages("folio")
## Load the package
library(nexus)
#> Loading required package: dimensio
nexus provides a set of S4 classes that represent different special
types of matrix (see vignette("nexus")
). The most basic class
represents a compositional data matrix, i.e. quantitative (nonnegative)
descriptions of the parts of some whole, carrying relative, rather than
absolute, information (J. Aitchison 1986).
It assumes that you keep your data tidy: each variable must be saved in its own column and each observation (sample) must be saved in its own row.
## Data from Wood and Liu 2023
data("bronze", package = "folio")
## Coerce to compositional data
coda <- as_composition(bronze, parts = 4:11)
## Use dynasties as groups
groups(coda) <- bronze$dynasty
## Compositional barplots of major elements
barplot(coda, select = is_element_major(coda), order_rows = "Cu",
border = NA, space = 0)
## Log-ratio analysis
## (PCA of centered log-ratio; outliers should be removed first)
clr <- transform_clr(coda, weights = TRUE)
lra <- pca(clr)
## Visualize results
viz_individuals(lra, color = c("#004488", "#DDAA33", "#BB5566"))
viz_hull(x = lra, border = c("#004488", "#DDAA33", "#BB5566"))
viz_variables(lra)
Please note that the nexus project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.