mov_avg | R Documentation |
Smooth numeric series with a moving average windows.
mov_avg(
x,
col_name = "last",
k,
pos = "c",
out_name = NULL,
from = NULL,
to = NULL
)
x |
data frame (or tibble) with class |
col_name |
string vector with the column(s) name(s) of the series to smooth. The default value
uses the |
k |
numeric vector with the windows size. E.g.: |
pos |
string vector with the position of the windows:
|
out_name |
optional. String vector with new column names. If you set it as |
from |
optional. String value for |
to |
optional. String value for |
The same data frame but with the smooth series.
# read guido daily streamflow records
path <- system.file('extdata', 'snih_qd_guido.xlsx',
package = 'hydrotoolbox')
# read and apply the function
qd_guido <-
read_snih(path = path, by = 'day', out_name = 'q(m3/s)') %>%
mov_avg(k = 5, out_name = 'q_smooth')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.