Skip to content

Commit

Permalink
Fixed issue when only one timestamp at midnight exists. Fixes Issue t…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hochenbaum committed Apr 1, 2015
1 parent adcb6ff commit 507c947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/ts_anom_detection.R
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ AnomalyDetectionTs <- function(x, max_anoms = 0.10, direction = 'pos',

}

# Fix to make sure date-time is correct and that we retain hms at midnight
all_anoms[[1]] <- format(all_anoms[[1]], format="%Y-%m-%d %H:%M:%S")

# Store expected values if set by user
if(e_value) {
anoms <- data.frame(timestamp=all_anoms[[1]], anoms=all_anoms[[2]], expected_value=subset(seasonal_plus_trend[[2]], as.POSIXlt(seasonal_plus_trend[[1]], tz="UTC") %in% all_anoms[[1]]))
Expand Down
3 changes: 3 additions & 0 deletions R/vec_anom_detection.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ AnomalyDetectionVec = function(x, max_anoms=0.10, direction='pos', alpha=0.05, p
xgraph <- xgraph + add_formatted_y(yrange, y_log=y_log)
}

# Fix to make sure date-time is correct and that we retain hms at midnight
all_anoms[[1]] <- format(all_anoms[[1]], format="%Y-%m-%d %H:%M:%S")

# Store expected values if set by user
if(e_value) {
anoms <- data.frame(index=all_anoms[[1]], anoms=all_anoms[[2]], expected_value=subset(seasonal_plus_trend[[2]], seasonal_plus_trend[[1]] %in% all_anoms[[1]]))
Expand Down

0 comments on commit 507c947

Please sign in to comment.