From 8b1d733e1612732525e2f0a35c25efbc0b24b7a2 Mon Sep 17 00:00:00 2001 From: Abel 'Akronix' Serrano Juste Date: Wed, 13 Mar 2024 14:13:07 +0100 Subject: [PATCH] Fix bug in forcejump() Fixes bug whereby missing values or previously corrected values with proc_dendro where not in the right place when calculating the value diff for determining the corrected value after doing a force jump. --- R/functions_corr.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/functions_corr.R b/R/functions_corr.R index 8dedd59..332ebc8 100644 --- a/R/functions_corr.R +++ b/R/functions_corr.R @@ -107,6 +107,7 @@ forcejump <- function(data_L2, force, n_days = 5) { dplyr::mutate(diff = c(NA, diff(value, lag = 1))) %>% dplyr::select(ts, diff) %>% dplyr::right_join(., data_L2, by = "ts") %>% + dplyr::arrange(ts) %>% dplyr::select(diff) %>% unlist(., use.names = FALSE)