R package hyperSpec is the main package in the r-hyperspec family of packages. The goal of hyperSpec (and whole r-hyperspec) is to make the work with hyperspectral data sets, (i.e. spatially or time-resolved spectra, or spectra with any other kind of information associated with each of the spectra) more comfortable. The spectra can be data as obtained during XRF, UV/VIS, Fluorescence, AES, NIR, IR, Raman, NMR, MS, etc. spectroscopy measurements. More generally, any data that is recorded over a discretized variable, e.g. absorbance = f(wavelength), stored as a vector of absorbance values for discrete wavelengths is suitable.

Documentation

There are two versions of hyperSpec online documentation:

a. for the released version and

b. for the development version of hyperSpec.

The documentation of the other r-hyperspec family packages can be found at r-hyperspec.github.io.

Issues, Bug Reports and Feature Requests

Issues, bug reports and feature requests should go here!

Installation

Install from CRAN

You can install the released version of hyperSpec from CRAN with:

install.packages("hyperSpec")

Install from GitHub

You can install the development version of the package from GitHub:

if (!require(remotes)) {install.packages("remotes")}
remotes::install_github("cbeleites/hyperSpec/hyperSpec")

NOTE 1: Usually, “Windows” users need to download, install and properly configure Rtools (see these instructions) to make the code above work.

NOTE 2: This method will not install package’s documentation (help pages and vignettes) into your computer. So you can either use the online documentation or build the package from source (see the next section).

Install from Source

  1. From the hyperSpec’s GitHub repository:
    • If you use Git, git clone the branch of interest. You may need to fork it before cloning.
    • Or just chose the branch of interest (1 in Figure below), download a ZIP archive with the code (2, 3) and unzip it on your computer.
      image
  2. Open the downloaded directory in RStudio (preferably, as an RStudio project).
    • The code below works correctly only if your current working directory coincides with the root of the repository, i.e., if it is in the directory that contains file README.md and sub-directory hyperSpec.
    • If you open RStudio project correctly (e.g., by clicking project.Rproj icon image in the directory), then the working directory is set correctly by default.
  3. In RStudio ‘Console’ window, run the code (provided below) to: a. Install packages remotes and devtools. b. Install hyperSpec’s dependencies. c. Create hyperSpec’s documentation. d. Install package hyperSpec.
# Do not abort installation even if some packages are not available
Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS = TRUE)

# Install packages remotes and devtools
install.packages(c("remotes", "devtools"))

# Install hyperSpec's dependencies
remotes::install_deps("hyperSpec", dependencies = TRUE)

# Create hyperSpec's documentation
devtools::document("hyperSpec")

# Install package hyperSpec and its dependencies
devtools::install("hyperSpec", build_vignettes = TRUE)

NOTE 1: Usually, “Windows” users need to download, install and properly configure Rtools (see these instructions) to make the code above work.