library("testthat")
library("spectrolab")
context("Spectra combine")
spec = as_spectra(spec_matrix_example, name_idx = 1)
s1 = spec
bands(s1) = seq(ncol(s1))
s2 = spec[ , 400:2000]
test_that("combining wrong class throws", {
expect_error( combine(spec, as.matrix(spec)) )
})
test_that("combining incompatible band values throws", {
expect_error( combine(spec, s1) )
})
test_that("combining different band number throws", {
expect_error( combine(spec, s2) )
})
test_that("combining identical obj doubles the number of samples", {
expect_true( nrow(combine(spec, spec)) == nrow(spec) * 2 )
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.