twitter / AnomalyDetection

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

Error when granularity is daily and only_last is null #8

Closed adamatw closed 9 years ago

adamatw commented 9 years ago

There's seems to be a bug for data with daily granularity. If gran == day, AnomalyDetectionTs does a check:

if(only_last == 'hr')

However, only_last can also be null. If it is, this check generates an error which keeps AnomalyDetectionTs from finishing:

Error in if (only_last == "hr") { : argument is of length zero

I submitted a pull request which fixes the problem by checking only_last for null first.

Also, thanks for a super package.

jhochenbaum commented 9 years ago

Thanks!

jhochenbaum commented 9 years ago

@owenvallis checked in a similar patch just now - thanks again for the initial patch and pointing this out @adamatw

adamatw commented 9 years ago

Looks good to me -- thanks!