Subsetting spectra with integer names is very confusing! Check this out:
library(spectrolab)
x = as.spectra(spec_matrix_example[1:5, ])
names(x) = c(1,1,1,2,3)
# Now, one cannot access the 1st spectrum because the two subset statements below are equivalent
identical(x[1, ], x["1", ])
# Even worse, these two statements return the last spectrum!
identical(x[3, ], x[5, ])
I could differentiate between quoted (char) and unquoted (int) arguments, but that also seems confusing. I could simply force sample names to be char.
Fixed in the "develop" branch. See commits 5c5cfe7 to 59a4f6c.
The spectra constructor and names setter do not allow names that are coercible to numeric. If given a numeric, the ctor adds a prefix.
Subsetting spectra with integer names is very confusing! Check this out:
I could differentiate between quoted (char) and unquoted (int) arguments, but that also seems confusing. I could simply force sample names to be char.