rubitMedianFilter: Apply a running median filter on an an area matrix.

Description Usage Arguments Value See Also Examples

View source: R/medianFilter.R

Description

This function is used to eliminate outliers from an area matrix.

Usage

1
rubitMedianFilter(m, k = 15)

Arguments

m

a numerical matrix corresponding to an area.

k

an integer specifying the size of the smoothing window. It must be odd.

Value

A numerical matrix of the same dimension as m.

See Also

rubitLinearInterpolate to get regular sampling after filtering.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(weevils_raw)

### Apply different 'k' values to a list of area matrices:
w15 <- lapply(weevils_raw, rubitMedianFilter, k = 15)
w101 <- lapply(weevils_raw, rubitMedianFilter, k = 101)

### See impacts of smoothing parameter 'k' on a trajectory:
## raw trajectory
plot(weevils_raw[['08']][1:100,'X'] ~ weevils_raw[['08']][1:100,'Y'], asp=1, type='l')
## acceptable level of smoothing
lines(w15[['08']][1:100,'X'] ~ w15[['08']][1:100,'Y'],col='green')
## oversmoothed
lines(w101[['08']][1:100,'X'] ~ w101[['08']][1:100,'Y'],col='red')

JoGall/rubitrail documentation built on May 7, 2019, 10:53 a.m.