twitter / AnomalyDetection

Anomaly Detection with R
GNU General Public License v3.0
3.55k stars 776 forks source link

Error: "data must be a single data frame, list, or vector that holds numeric values" When data is a dataframe in correct format... #47

Open nullbuddy1243 opened 9 years ago

nullbuddy1243 commented 9 years ago

Hey everyone.

I am trying to run my dataframe through the AnomalyDetectorVec(). My dataframe is a small one, for now, and I believe it is in the correct format.

Here is the dataframe:

> str(es_out)

'data.frame':   500 obs. of  2 variables:
 $ timestamp_list: POSIXct, format: "2015-07-23 04:10:56" "2015-07-23 04:10:51" "2015-07-23 04:11:11" ...
 $ in_bytes_list : int  3893 3893 2335 2319 3893 125 71 71 52 657 ...

When I try to run it through AnomalyDetectorVec(), I get an error:

> AnomalyDetectionVec(es_out, period=500, plot=TRUE, verbose=TRUE)

Error in AnomalyDetectionVec(es_out, period = 500, plot = TRUE, verbose = TRUE) : 
  data must be a single data frame, list, or vector that holds numeric values.

What is going wrong here? I cannot seem to figure it out...

Here is a dput() of my dataset and my dataframe conversion funciton in a pastebin, for cleanliness.

Dataset dput(): http://pastebin.com/WkY7pvwt Dataframe conversion function: http://pastebin.com/EsAcVNbV

Any help would be greatly appreciated. As far as I can tell, my dataframe is in the correct format, but I guess it actually isn't.

Thanks!

terrytangyuan commented 9 years ago

@deusofnull You need to have a single column data frame, list, or vector as the input argument x in order to use AnomalyDetectorVec(). Instead, you can use AnomalyDetectionTs(). Please take a look at the help files for detailed usage of these functions.

nullbuddy1243 commented 9 years ago

Thanks @terrytangyuan , I am new to R and didnt realize the [,2] syntax for column selection...

terrytangyuan commented 8 years ago

Could anyone close this?