box_smooth {growR} | R Documentation |
Endpoint smoother
Description
Smooth data in vector x to its endpoint.
Usage
box_smooth(x, box_width = 28)
Arguments
x |
1D data to be smoothed. |
box_width |
Width (in units of vector steps) of the box used for smoothing. |
Details
Employ an endpoint box filter (aka "running mean" or endpoint smoother) to the 1-D data in x:
x_smoothed[i] = mean(x[i-box_width:i])
Where x is considered to be zero-padded vor values of i-box_width < 1.
Value
x_smooth Smoothened version of x.
Examples
# Create a sine wave with noise
x = seq(0, 4*pi, 0.1)
y = sin(x) + runif(length(x))
# Apply endpoint smoothing
y_smooth = box_smooth(y, box_width = 5)
[Package growR version 1.3.0 Index]