Learn R Programming

hyperSpec (version 0.98-20140523)

split: Split a hyperSpec object according to groups split divides the hyperSpec object into a list of hyperSpec objects according to the groups given by f.

Description

The hyperSpec objects in the list may be bound together again by bind ("r", list_of_hyperSpec_objects).

Usage

## S3 method for class 'hyperSpec':
split(x, f, drop = TRUE,
    short = NULL, user = NULL, date = NULL)

Arguments

x
the hyperSpec object
f
a factor giving the grouping (or a variable that can be converted into a factor by as.factor)
drop
if TRUE, levels off that do not occur are dropped.
short,user,date
handed to logentry

Value

  • A list of hyperSpec objects.

See Also

split

Examples

Run this code
dist <- pearson.dist (chondro[[]])
dend <- hclust (dist, method = "ward")
z <- cutree (dend, h = 0.15)

clusters <- split (chondro, z)
length (clusters)

# difference in cluster mean spectra
plot (apply (clusters[[2]], 2, mean) - apply (clusters[[1]], 2, mean))

Run the code above in your browser using DataLab