bind {hyperSpec}R Documentation

Binding hyperSpec Objects

Description

Two S3 functions cbind.hyperSpec and rbind.hyperSpec act as an interfaces to cbind2 and rbind2 because neither rBind and cBind nor S4 versions of cbind and rbind do work at the moment.

Usage

cbind.hyperSpec (..., deparse.level)
rbind.hyperSpec (..., deparse.level)

## S4 method for signature 'hyperSpec, hyperSpec':
cbind2(x, y)
## S4 method for signature 'hyperSpec, hyperSpec':
rbind2(x, y)

## S4 method for signature 'hyperSpec, missing':
cbind2(x, y)
## S4 method for signature 'hyperSpec, missing':
rbind2(x, y)

bind(direction = stop("direction ('c' or 'r') required"), ...,
   short = NULL, user = NULL, date = NULL)

Arguments

... The hyperSpec objects to be combined.
Alternatively, one list of hyperSpec objects can be given to bind.
deparse.level ignored.
short, user, date for the log
x, y hyperSpec objects
direction "r" or "c" to bind rows or columns

Details

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.

rbind2 binds two hyperSpec objects by row. They need to have the same columns.

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.

bind does the common work for both column- and row-wise binding.

Value

a hyperSpec object, possibly with different row order (for bind ("c", ...) and cbind2).

Note

You might have to make sure that the objects either all have or all do not have rownames and/or colnames.

Author(s)

C. Beleites

See Also

rBind, cBind rbind2, cbind2 rbind, cbind

Examples

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


[Package hyperSpec version 0.95 Index]