View source: R/ga_anomaly_detection.R
A function to perform Anomaly Detection This is based on Twitter's package
1 2 3 |
... |
extra values to be passed to AnomalyDetection::AnomalyDetectionTs. |
df |
Data frame |
time_col |
Column that has time data. We assume this is either 'date', 'datehour“ from Google Analytics API |
value_col |
Column that has value data |
direction |
Direction of anomaly. Positive ("posi"), Negative ("neg") or "both". |
longterm |
Increase anom detection efficacy for time series that are greater than a month. This automatically becomes TRUE if the data is longer than 30 days. |
time_unit |
Time unit for aggregation. |
fun.aggregate |
Function to aggregate values. |
e_value |
Whether expected values should be returned. |
na_fill_type |
- Type of NA fill: "previous" - Fill with previous non-NA value. "value" - Fill with the value of na_fill_value. "interpolate" - Linear interpolation. "spline" - Spline interpolation. NULL - Skip NA fill. Use this only when you know there is no NA. |
na_fill_value |
- Value to fill NA when na_fill_type is "value" |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.