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

# S4 method for hyperSpec
split(x, f, drop = TRUE)

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.

Value

A list of hyperSpec objects.

Details

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

See also

Author

C. Beleites

Examples


dist <- dist_pearson(faux_cell[[]])
dend <- hclust(dist, method = "ward")
#> The "ward" method has been renamed to "ward.D"; note new "ward.D2"
z <- cutree(dend, h = 0.15)

region <- split(faux_cell, z)
length(region)
#> [1] 54

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