Learn R Programming

spectrolab (version 0.0.12)

combine: Combine spectral datasets

Description

combine binds two spectral datasets. Both spectra must have the very same band labels, but different metadata are acceptable

Usage

combine(s1, s2)

# S3 method for spectra combine(s1, s2)

Arguments

s1

spectra object 1

s2

spectra object 2

Value

combined spectra object

Methods (by class)

  • spectra: Combines two spectral datasets

Examples

Run this code
# NOT RUN {
library(spectrolab)

# Create dummy spectra datasets. Pretend that these are all different...
s1 = as_spectra(spec_matrix_example, name_idx = 1)
s2 = as_spectra(spec_matrix_example, name_idx = 1)
s3 = as_spectra(spec_matrix_example, name_idx = 1)

# combine 2 spectra objects
s_1and2 = combine(s1, s2)

# combine n spectra objects using the `Reduce` function
s_n = Reduce(combine, list(s1, s2, s3))
# }

Run the code above in your browser using DataLab