r-hyperspec / hyperSpec

hyperSpec: Tools for Spectroscopy (R package)
https://r-hyperspec.github.io/hyperSpec/
GNU General Public License v3.0
12 stars 3 forks source link

Allow new `hyperSpec` object without wavelengths #99

Open GegznaV opened 2 years ago

GegznaV commented 2 years ago

This is https://github.com/cbeleites/hyperSpec/issues/296


Suggested:

new("hyperSpec", data = data.frame(c = 1:5))

this works:

new("hyperSpec",
     wavelength = numeric(0),
     spc = matrix(NA_real_, ncol = 0, nrow = 5), 
     data = data.frame(c = 1:5)
)
GegznaV commented 2 years ago

Currently, the official solution to this issue in hyperSpec is to use as.hyperSpec():

as.hyperSpec(data.frame(c = 1:5))
as.hyperSpec(as.matrix(data.frame(c = 1:5)))
as.hyperSpec(matrix(1:5))