rollmean_ {cycleRtools} | R Documentation |
Smooth data with a right-aligned (zero-padded) rolling average.
rollmean_(x, window, ema, narm) rollmean_smth(data, column, smth.pd, deltat = NULL, ema = FALSE, character.only = FALSE)
x |
numeric; values to be rolled over. |
window |
numeric; size of the rolling window in terms of elements in
|
ema |
logical; should the moving average be exponentially weighted? |
narm |
logical; should |
data |
a dataset of class |
column |
the column name of the data to be smoothed, needn't be quoted. |
smth.pd |
numeric; the time period over which to smooth (seconds). |
deltat |
the sampling frequency of |
character.only |
are column name arguments given as character strings? A backdoor around non-standard evaluation. |
rollmean_
is the core Rcpp function, which rolls over elements in
x
by a window given in window
; optionally applying exponential
weights and/or removing NA
s. rollmean_smth
is a wrapper for
rollmean_
that only has a method for cycleRdata
objects. The
latter will pre-process the data and permits what is effectively the
window
argument being given in time units.
a vector of the same length as the data[, column]
.
## Not run: data(ridedata) ## Smooth power data with a 30 second moving average. rollmean_smth(ridedata, power.W, 30) ## Or use an exponentially weighted moving average. rollmean_smth(ridedata, power.W, 30, ema = TRUE) ## End(Not run)