Learn R Programming

cgraph (version 3.0.1)

bsum: Block Summation

Description

Divide a vector or array in consecutive blocks of n elements and sum the elements at each position in these blocks.

Usage

bsum(x, n = 1)

Arguments

x,

numeric vector or array, the object that is summed.

n,

numeric scalar, block size. Defaults to 1.

Value

numeric vector, a n-dimensional vector, where the 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.