filterWgts: Create filter weights

View source: R/supportFunctions.R

filterWgtsR Documentation

Create filter weights

Description

Create filter weights. Typically used to compute even, weighted, or center-weighted averages for smoothing. Can be used as a vector of weights in stats::filter

Usage

filterWgts(n = NULL, type = "weighted")

Arguments

n

number of values

type

Averaging method ("uniform" [even], "weighted" [default], or "centered") for creating weights.

Value

Returns vector of weights

Examples

wgts<- filterWgts(0,"uniform")
wgts<- filterWgts(7,"uniform")
wgts<- filterWgts(7,"centered")
wgts<- filterWgts(7,"weighted")
x <- 1:100
filter(x, filterWgts(7,"weighted"), sides=1)

leppott/baytrends documentation built on Nov. 2, 2024, 6:42 p.m.