block.data.frame: Block-wise indexable data.frame

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

This is a convenience function for making data.frames that are easily indexed on a block-wise basis.

Usage

1
block.data.frame(X, block_inds = NULL, to.matrix = TRUE)

Arguments

X

Either a single data.frame to index or a list of matrices/data.frames

block_inds

Named list of indexes if X is a single data.frame, otherwise NULL.

to.matrix

logical indicating if input list elements should be converted to matrices.

Value

A data.frame which can be indexed block-wise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Random data
M <- matrix(rnorm(200), nrow = 10)
# .. with dimnames
dimnames(M) <- list(LETTERS[1:10], as.character(1:20))

# A named list for indexing
inds <- list(B1 = 1:10, B2 = 11:20)

X <- block.data.frame(M, inds)
str(X)

multiblock documentation built on Jan. 4, 2022, 5:10 p.m.