Skip to content

Commit 30da570

Browse files
committed
fix format difference bug
1 parent af6bacd commit 30da570

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

R/ts_anom_detection.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,10 @@ AnomalyDetectionTs <- function(x, max_anoms = 0.10, direction = 'pos',
344344

345345
# Store expected values if set by user
346346
if(e_value) {
347+
# use the same format with all_anoms[[1]]
348+
trend_timestamp <- format(as.POSIXlt(seasonal_plus_trend[[1]], tz="UTC"), format="%Y-%m-%d %H:%M:%S")
347349
anoms <- data.frame(timestamp=all_anoms[[1]], anoms=all_anoms[[2]],
348-
expected_value=subset(seasonal_plus_trend[[2]], as.POSIXlt(seasonal_plus_trend[[1]], tz="UTC") %in% all_anoms[[1]]),
350+
expected_value=subset(seasonal_plus_trend[[2]], trend_timestamp %in% all_anoms[[1]]),
349351
stringsAsFactors=FALSE)
350352
} else {
351353
anoms <- data.frame(timestamp=all_anoms[[1]], anoms=all_anoms[[2]], stringsAsFactors=FALSE)

0 commit comments

Comments
 (0)