Learn R Programming

hyperSpec (version 0.98-20140523)

bind: Binding hyperSpec Objects 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.

Description

While it is now possible to do S4 despatch on ...

Usage

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

cbind.hyperSpec(..., short = "cbind", deparse.level)

rbind.hyperSpec(..., short = "rbind", deparse.level)

## S3 method for class 'hyperSpec,hyperSpec': cbind2(x, y)

## S3 method for class 'hyperSpec,missing': cbind2(x, y)

## S3 method for class 'hyperSpec,hyperSpec': rbind2(x, y)

## S3 method for class 'hyperSpec,missing': rbind2(x, y)

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
direction
"r" or "c" to bind rows or columns
x,y
hyperSpec objects

Value

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

code

hyperSpec

Details

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

See Also

rBind, cBind rbind2, cbind2 rbind, cbind

merge and collapse for combining objects that do not share spectra or wavelengths, respectively.

Examples

Run this code
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

Run the code above in your browser using DataLab