block_sum: Sum over a selected block in a block matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/block_sum.R

Description

Returns of a sum of a block within a matrix. This function is predominantly intended to be used within the ipf2_block routine.

Usage

1
block_sum(block = NULL, m = NULL, block_id = NULL)

Arguments

block

Numeric value of block to summed. To be matched against the matrix in block_id.

m

Matrix of all blocks combined.

block_id

Matrix of the same dimensions of m used to identify blocks.

Value

Returns a numeric value of the sum of a single block.

Author(s)

Guy J. Abel

See Also

block_matrix, stripe_matrix, ipf2_block

Examples

1
2
3
4
5
m <- matrix(data = 100:220, nrow = 11, ncol = 11)
b <- block_matrix(x = 1:16, b = c(2, 3, 4, 2))
block_sum(block = 1, m = m, block_id = b)
block_sum(block = 4, m = m, block_id = b)
block_sum(block = 16, m = m, block_id = b)

Example output

[1] 424
[1] 460
[1] 856

migest documentation built on July 25, 2021, 9:07 a.m.