Learn R Programming

migest (version 1.7.3)

block.matrix: Create a Block Matrix with Non-Uniform Block Sizes.

Description

Creates a matrix with differing size blocks

Usage

block.matrix(x = NULL, b = NULL, byrow = FALSE, dimnames = NULL)

Arguments

x
A vector of numbers to fill each block
b
The size of the square matrices that lie on the diagonal of the matrix.
byrow
logical. If FALSE (the default) the matrix blocks are filled by columns, otherwise the matrix blocks are filled by rows.
dimnames
A dimnames attribute for the matrix: NULL or a vector of the same length of b giving the basis of row and column names.

Value

Matrix of values, where x is repeated in each block.

Details

Returns a matrix with blocks of sizes dictated by the b argument. Each block is filled with the same value.

See Also

ipf2.b, block.matrix

Examples

Run this code
block.matrix(x = 1:16, b = c(2,3,4,2), dimnames = LETTERS[1:4])

Run the code above in your browser using DataLab