Skip to contents

Converts an object (e.g., a hyperdesign) into a single multidesign object by collapsing its structure.

Converts a hyperdesign object into a single multidesign by row-stacking the data matrices and combining the design data frames. All blocks must have the same number of columns and identical column designs. This operation never joins rows by the declared entity ID. A hyperdesign declared with `space = "block"` is refused because its block columns are not comparable. Stored masks are row-stacked with the data. If only some blocks have masks, unmasked blocks are treated as all observed in the combined mask.

Usage

as_multidesign(x, ...)

# S3 method for class 'hyperdesign'
as_multidesign(x, .id = NULL, ...)

Arguments

x

A hyperdesign object

...

Additional arguments (not used)

.id

Optional character string. If provided, a column with this name is added to the design to identify the source block.

Value

A multidesign object

A single multidesign object

See also

hyperdesign for creating hyperdesign objects, multidesign for the multidesign class

Other hyperdesign functions: design.hyperdesign(), df_to_hyperdesign(), hyperdesign.list(), init_transform.hyperdesign(), subset.hyperdesign(), xdata.hyperdesign()

Examples

d1 <- multidesign(matrix(rnorm(10*5), 10, 5),
                  data.frame(condition = rep(c("A","B"), 5)))
d2 <- multidesign(matrix(rnorm(10*5), 10, 5),
                  data.frame(condition = rep(c("A","B"), 5)))
hd <- hyperdesign(list(d1, d2))

# Collapse hyperdesign to a single multidesign
md <- as_multidesign(hd)

d1 <- multidesign(matrix(rnorm(10*5), 10, 5),
                  data.frame(condition = rep(c("A","B"), 5)))
d2 <- multidesign(matrix(rnorm(10*5), 10, 5),
                  data.frame(condition = rep(c("A","B"), 5)))
hd <- hyperdesign(list(d1, d2))
md <- as_multidesign(hd)