View source: R/supportFunctions.R
filterWgts | R Documentation |
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
filterWgts(n = NULL, type = "weighted")
n |
number of values |
type |
Averaging method ("uniform" [even], "weighted" [default], or "centered") for creating weights. |
Returns vector of weights
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.