smoother | R Documentation |
Smooth a plot of metabolism data using a moving window average
smoother(x, ...)
## Default S3 method:
smoother(x, window = 5, sides = 2, ...)
x |
input object |
... |
additional arguments passed to |
window |
numeric vector defining size of the smoothing window, passed to |
sides |
numeric vector defining method of averaging, passed to |
This function uses a moving window average to smooth metabolism data for plotting. It has nothing to do with weighted regression (wtreg
) and is meant only for plotting aesthetics. The function is a simple wrapper to filter
. The window argument specifies the number of observations included in the moving average. The sides argument specifies how the average is calculated for each observation (see the documentation for filter
). A value of 1 will filter observations within the window that are previous to the current observation, whereas a value of 2 will filter all observations within the window centered at zero lag from the current observation.
Returns a data.frame
of the smoothed metabolism data.
filter
## Not run:
data(SAPDC)
# metadata for the location
tz <- 'America/Jamaica'
lat <- 31.39
long <- -81.28
# estimate ecosystem metabolism using observed DO time series
metab <- ecometab(SAPDC, DO_var = 'DO_obs', tz = tz,
lat = lat, long = long)
# smooth metabolism data with 20 day moving window average
tosmooth <- metab[, c('Pg', 'Rt', 'NEM')]
smoother(tosmooth, window = 20)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.