1 Reply Latest reply on Sep 11, 2016 8:17 AM by Yuriy Fal

    Problem Using Twitter Anomaly Detection in Tableau integrated with R

    han.zheng

      Hi all,

       

      I want to use the R package released by twitter to detect anomaly.

      http://127.0.0.1:28892/library/AnomalyDetection/html/AnomalyDetectionTs.html

      GitHub - twitter/AnomalyDetection: Anomaly Detection with R

      The function AnomalyDetectionTs needs an input dataframe consisting of timestamps and observations.

      Here is my calculated field code:

       

      SCRIPT_INT(

      'library(AnomalyDetection)

      df <- data.frame(arg1, .arg2)

      result<- AnomalyDetectionTs(df,max_anoms = .arg3, direction=.arg4,longterm = .arg5, alpha = .arg6, threshold = .arg7)

      ',

      ATTR([Time]), [Sum_Sess_Aggr],[max_anoms], [direction], [longterm],[Significance_level],[Threshold]

      )

       

      I tried to pass the aggregated time and observation values to R, but it always returns the following error:

       

      Error in if (stringr::str_detect(indf[[index]][1], "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2} \\+\\d{4}$")) { : missing value where TRUE/FALSE needed