svri {foqat} | R Documentation |
Compute the variation of summary statistics
Description
Compute the variation of summary statistics for time series.
Usage
svri(
df,
bkip = NULL,
mode = "recipes",
value = "day",
st = NULL,
et = NULL,
fun = "mean",
probs = 0.5,
na.rm = TRUE,
digits = 2,
wind = FALSE,
coliws = 2,
coliwd = 3,
sn = FALSE
)
Arguments
df |
dataframe of time series. |
bkip |
the basic time reslution for variation, such as '1 hour'. If mode "custom" is selected, do not need to enter bkip. |
mode |
for calculating cycles: "recipes", "ncycle", "custom". "recipes" means using internal setting for calculation. "ncycle" means setting number of items for per cycle. "custom" means using 1 column in dataframe as a list of grouping elements for calculation. |
value |
for detail setting of mode. Possible values for "recipes" are "day", "week", "month", year". "day" equals to 24 (hours) values in 1 day. "week" equals to 7 (days) values in 1 week. "month" equals to 31 (days) values in 1 month. "year" equals to 12 (months) values in 1 year. values for "ncycle" is a number representing number of items in per cycle. values for "custom" is a number representing column index in dataframe. |
st |
start time of resampling. The default value is the fisrt value of datetime column. |
et |
end time of resampling. The default value is the last value of datetime column. |
fun |
a function to compute the summary statistics which can be applied to all data subsets: 'sum', 'mean', 'median', 'min', 'max', 'sd' and 'quantile'. |
probs |
numeric vector of probabilities with values in \([0,1]\). |
na.rm |
logical value. Remove NA value or not? |
digits |
numeric value, digits for result dataframe. |
wind |
logical value. if TRUE, please set coliwd, coliws. |
coliws |
numeric value, column index of wind speed in dataframe. |
coliwd |
numeric value, column index of wind direction (degree) in dataframe. |
sn |
logical value. if TRUE, the results will be presented by scientific notation (string). |
Details
If you have wind data (wind speed, and wind direction in dgree), please set 'wind' as 'TRUE', and set values for 'coliwd' and 'coliws'.
Value
the variation of summary statistics Note that when the pattern USES "ncycle" or "custom", the start time determines the start time of the first element in the average variation. For example, if the first timestamp of data is "2010-05-01 12:00:00", the resolution is 1 hour, the mode is "ncycle", and the value is 24, then the result represents diurnal variation starting from 12 o'clock.
Examples
svri(met, bkip = "1 hour", mode = "recipes", value = "day", fun = 'quantile', probs=0.5,
st = "2017-05-01 00:00:00")