blockmean: Performs block mean

View source: R/matrices.R

blockmeanR Documentation

Performs block mean

Description

Given a matrix and the size of a block, returns a new matrix containing the average of each block.

Usage

blockmean(mat, block)

Arguments

mat

numeric matrix

block

integer vector of length 2, containing the size of the block (rows, columns). If only one integer is passed, the block is square

Value

A new reduced matrix with mean of each block

Examples

mat <- matrix(1:64, nrow = 8, byrow = TRUE)
mat

blockmean(mat, 2) # or blockmean(mat, c(2, 2))


Leonardo-Bo/rgrids documentation built on July 27, 2024, 2:19 a.m.