twitter / AnomalyDetection

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

Error message: Error in if (gran >= 86400) { : missing value where TRUE/FALSE needed #28

Open ghost opened 9 years ago

ghost commented 9 years ago

I'm trying to use AnomalyDetectionTs() exactly as described in the example, but with my own data. When i execute this command:

res = AnomalyDetectionTs(my_data, max_anoms=0.02, direction='both', plot=TRUE)

i get the following error:

Error in if (gran >= 86400) { : missing value where TRUE/FALSE needed

This is how my data looks like:

str(my_data) 'data.frame': 3841 obs. of 2 variables: $ INFO_DATE : POSIXct, format: "2015-01-11 00:01:21" "2015-01-11 00:20:55" ... $ QUANTITY : int 5881 9565 11268 12376 12983 13454 13956 14409 15613 21024 ...

Do you have any idea how to solve this problem?

ghost commented 9 years ago

Nevermind, i had some NA values in my data, so the timediff funtion returned NA. I removed them and now it works fine.