Introducing the spectrakit R package
If you regularly work with spectral data, you’ve probably run into the same
set of challenges: producing clear spectral plots, combining data from
multiple files, applying consistent normalization, explore patterns in the
data, and assembling publication-ready figures. The
spectrakit
R package is designed to streamline this entire workflow.
At its core, spectrakit provides a small set of focused tools for
handling, analyzing and visualizing spectral data, from raw files all the
way to final figures.
What spectrakit does
The package covers four common tasks:
- Visualizing spectra with flexible plotting options
- Combining spectra from multiple files into a single dataset
- Supporting exploration of spectral data using principal component analysis (PCA)
- Creating composite figures for publication-ready output
A simple workflow
Once the package is installed and loaded via
install.packages("spectrakit") and
library(spectrakit), a typical workflow with
spectrakit might look like:
- Plotting spectra for exploration or reporting
- Merge and normalize multiple spectra
- Analyze the spectral data with PCA
- Assemble final figures for publication
The package is designed so these steps work smoothly together, reducing the
need for custom scripts or manual adjustments.
The four core functions
This blog series walks through each of the main functions in detail:
-
plotSpectra()– create customizable spectral visualizations -
combineSpectra()– merge and normalize spectral datasets -
plotPCA()– explore patterns via principal component analysis -
makeComposite()– build labeled image grids for publication
Each function gets its own post with examples and tips.
Where to start
If you’re new to the package, the best place to begin is with
plotSpectra(), to turn your spectral data into clear, customizable visualizations. From
there, you can move on to data handling and analysis, or figure creation
depending on your workflow.
Final thoughts
The goal of spectrakit is simple: make common spectral data tasks
faster, cleaner and more reproducible. Instead of stitching together multiple
tools, you get a compact, consistent toolkit built around real analysis
workflows.
Citation
If you use spectrakit in your research, please cite it as follows:
Pastorelli G (2026). spectrakit: Spectral Data Handling and Visualization.
R package version 0.2.0. DOI: 10.32614/CRAN.package.spectrakit. Available
at: https://CRAN.R-project.org/package=spectrakit
A BibTeX entry for LaTeX users is
@Manual{spectrakit,
title = {spectrakit: Spectral Data Handling and Visualization},
author = {Gianluca Pastorelli},
year = {2026},
note = {R package version 0.2.0},
url = {https://CRAN.R-project.org/package=spectrakit},
doi = {10.32614/CRAN.package.spectrakit},
}
About the author
Gianluca Pastorelli
is a Heritage Scientist (Senior Researcher) working at the National
Gallery of Denmark (SMK).




Comments
Post a Comment