Learn R Programming

xcms (version 1.48.0)

medianFilter: Apply a median filter to a matrix

Description

For each element in a matix, replace it with the median of the values around it.

Usage

medianFilter(x, mrad, nrad)

Arguments

x
numeric matrix to median filter
mrad
number of rows on either side of the value to use for median calculation
nrad
number of rows on either side of the value to use for median calculation

Value

A matrix whose values have been median filtered

Examples

Run this code
mat <- matrix(1:25, nrow=5)
mat
medianFilter(mat, 1, 1)

Run the code above in your browser using DataLab