While it is now possible to do S4 despatch on ...{}
, defining such
S4 methods for cbind
and rbind
breaks the binding of
Matrix
objects. Therefore, two S3 methods rbind.hyperSpec
and
cbind.hyperSpec
are defined.
cbind2
binds the spectral matrices of two hyperSpec
objects by column. All columns
besides spc
with the same name in x@data
and y@data
must have the same
elements. Rows are ordered before checking.
rbind2
binds two hyperSpec
objects by row. They need to have
the same columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  bind(direction = stop("direction ('c' or 'r') required"), ...,
wl.tolerance = hy.getOption("wl.tolerance"))
cbind.hyperSpec(...)
rbind.hyperSpec(...)
## S4 method for signature 'hyperSpec,hyperSpec'
cbind2(x, y)
## S4 method for signature 'hyperSpec,missing'
cbind2(x, y)
## S4 method for signature 'hyperSpec,hyperSpec'
rbind2(x, y,
wl.tolerance = hy.getOption("wl.tolerance"))
## S4 method for signature 'hyperSpec,missing'
rbind2(x, y, wl.tolerance)

direction 
"r" or "c" to bind rows or columns 
... 
The Alternatively, one list of 
wl.tolerance 

x,y 

bind
does the common work for both column and rowwise binding.
a hyperSpec
object, possibly with different row order (for
bind ("c", ...{})
and cbind2
).
You might have to make sure that the objects either all have or all do not have rownames and/or colnames.
C. Beleites
rBind
, cBind
rbind2
, cbind2
rbind
, cbind
merge
and collapse
for combining objects that do not share spectra
or wavelengths, respectively.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  chondro
bind ("r", chondro, chondro)
rbind (chondro, chondro)
cbind (chondro, chondro)
bind ("r", list (chondro, chondro, chondro))
x < chondro[,, 600 : 605]
x$a < 1
x@data < x@data[, sample (ncol (x), ncol (x))] # reorder columns
y < chondro [nrow (chondro) : 1,, 1730 : 1750] # reorder rows
y$b < 2
cbind2 (x, y) # works
y$y[3] < 5
try (cbind2 (x, y)) # error

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.