-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmoother.Rd
51 lines (44 loc) · 1.84 KB
/
smoother.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/smoother.R
\name{smoother}
\alias{smoother}
\alias{smoother.default}
\title{Smooth a plot of metabolism data}
\usage{
smoother(x, ...)
\method{smoother}{default}(x, window = 5, sides = 2, ...)
}
\arguments{
\item{x}{input object}
\item{...}{additional arguments passed to \code{\link[stats]{filter}}}
\item{window}{numeric vector defining size of the smoothing window, passed to \code{filter}}
\item{sides}{numeric vector defining method of averaging, passed to \code{filter}}
}
\value{
Returns a \code{data.frame} of the smoothed metabolism data.
}
\description{
Smooth a plot of metabolism data using a moving window average
}
\details{
This function uses a moving window average to smooth metabolism data for plotting. It has nothing to do with weighted regression (\code{\link{wtreg}}) and is meant only for plotting aesthetics. The function is a simple wrapper to \code{\link[stats]{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 \code{\link[stats]{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.
}
\examples{
\dontrun{
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)
}
}
\seealso{
\code{\link[stats]{filter}}
}
\concept{analyze}