Overview
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:
- Compositional statistics.
- Compositional data visualization.
- Logratio transformations:
transform_lr()
,transform_clr()
,transform_alr()
,transform_ilr()
,transform_plr()
. - Zero and missing value replacement.
- Outlier detection:
detect_outlier()
.
This package also includes methods for provenance studies:
- Multivariate analysis:
pca()
. - Mixed-mode analysis using geochemical and petrographic data (Baxter et al. 2008):
mix()
.
isopleuros is a companion package to nexus that allows to create ternary plots.
To cite nexus in publications use:
Frerebeau N, Philippe A (2025). nexus: Sourcing Archaeological Materials by Chemical Composition. Université Bordeaux Montaigne, Pessac, France. doi:10.5281/zenodo.10225630 https://doi.org/10.5281/zenodo.10225630, R package version 0.5.0, https://packages.tesselle.org/nexus/.
This package is a part of the tesselle project https://www.tesselle.org.
Installation
You can install the released version of nexus from CRAN with:
install.packages("nexus")
And the development version from Codeberg with:
# install.packages("remotes")
remotes::install_git("https://codeberg.org/tesselle/nexus")
Usage
## 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
coda <- group(coda, by = bronze$dynasty)
## Select major elements
major <- coda[, is_element_major(coda)]
## Compositional barplot
barplot(major, order_rows = "Cu", names = FALSE, 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(
x = lra,
extra_quali = group_names(clr),
color = c("#004488", "#DDAA33", "#BB5566"),
hull = TRUE
)
viz_variables(lra)
Translation
This package provides translations of user-facing communications, like messages, warnings and errors, and graphical elements (axis labels). The preferred language is by default taken from the locale. This can be overridden by setting of the environment variable LANGUAGE
(you only need to do this once per session):
Sys.setenv(LANGUAGE = "<language code>")
Languages currently available are English (en
) and French (fr
).
Contributing
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.