bsum {cgraph}R Documentation

Block Summation

Description

Divide a vector or array in consecutive fixed-sized blocks and sum the elements at each position in these blocks.

Usage

bsum(x, block_size = 1)

Arguments

x,

numeric vector or array, the object that is summed.

block_size,

numeric scalar, the size of each block. Defaults to 1.

Value

numeric vector. Each 1th element of the vector is the sum of each 1th element of the blocks, the 2nd element of the vector is the sum of each 2nd element of the blocks, and so on.

Note

If x is an array and block_size is equal to the size of x's first dimension, then bsum behaves as rowSums.

Author(s)

Ron Triepels


[Package cgraph version 4.0.3 Index]