From adf124cbb5e1551e10af6f70035c2afca0e070fa Mon Sep 17 00:00:00 2001 From: vagudets Date: Fri, 25 Oct 2024 16:50:48 +0200 Subject: [PATCH 1/4] Add fix for #154 --- modules/Aggregation/Aggregation.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/Aggregation/Aggregation.R b/modules/Aggregation/Aggregation.R index e4cc6b97..13f75f1f 100644 --- a/modules/Aggregation/Aggregation.R +++ b/modules/Aggregation/Aggregation.R @@ -14,7 +14,7 @@ Aggregation <- function(recipe, data) { ncores <- recipe$Analysis$ncores # is it already checked? NULL or number na.rm <- ifelse(is.null(recipe$Analysis$remove_NAs), TRUE, recipe$Analysis$remove_NAs) # is it already checked? TRUE/FALSE - if (recipe$Analysis$Workflow$Time_aggregation$execute) { + if isTRUE(recipe$Analysis$Workflow$Time_aggregation$execute) { # original freq raw_freq <- tolower(recipe$Analysis$Variable$freq) custom <- recipe$Analysis$Workflow$Time_aggregation$user_def @@ -56,6 +56,12 @@ Aggregation <- function(recipe, data) { stop("Time_aggregation$user_def is not a list") } } + return(res) + } else { + warn(recipe$Run$logger, + paste("The Aggregation module has been called but Aggregation:execute", + "is set to 'no' in the recipe. The data is returned unchanged.")) + return(data) } return(res) info(recipe$Run$logger, -- GitLab From 59f14f80c4caa42c26a9b2dce7d8bd69ec29b52c Mon Sep 17 00:00:00 2001 From: vagudets Date: Fri, 25 Oct 2024 16:53:02 +0200 Subject: [PATCH 2/4] Fix typos --- modules/Aggregation/Aggregation.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Aggregation/Aggregation.R b/modules/Aggregation/Aggregation.R index 13f75f1f..d9f0a274 100644 --- a/modules/Aggregation/Aggregation.R +++ b/modules/Aggregation/Aggregation.R @@ -59,11 +59,11 @@ Aggregation <- function(recipe, data) { return(res) } else { warn(recipe$Run$logger, - paste("The Aggregation module has been called but Aggregation:execute", - "is set to 'no' in the recipe. The data is returned unchanged.")) + paste("The Aggregation module has been called but parameter", + "Time_aggregation:execute is set to 'no' in the recipe.", + "The data is returned unchanged.")) return(data) } - return(res) info(recipe$Run$logger, "##### TIME AGGREGATION COMPLETE #####") } -- GitLab From 9e9b3ec58c90c48044aeb8c2f54924f3921eb2b8 Mon Sep 17 00:00:00 2001 From: vagudets Date: Fri, 25 Oct 2024 16:55:30 +0200 Subject: [PATCH 3/4] Fix if condition --- modules/Aggregation/Aggregation.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Aggregation/Aggregation.R b/modules/Aggregation/Aggregation.R index d9f0a274..30bf4fa3 100644 --- a/modules/Aggregation/Aggregation.R +++ b/modules/Aggregation/Aggregation.R @@ -14,7 +14,7 @@ Aggregation <- function(recipe, data) { ncores <- recipe$Analysis$ncores # is it already checked? NULL or number na.rm <- ifelse(is.null(recipe$Analysis$remove_NAs), TRUE, recipe$Analysis$remove_NAs) # is it already checked? TRUE/FALSE - if isTRUE(recipe$Analysis$Workflow$Time_aggregation$execute) { + if (isTRUE(recipe$Analysis$Workflow$Time_aggregation$execute)) { # original freq raw_freq <- tolower(recipe$Analysis$Variable$freq) custom <- recipe$Analysis$Workflow$Time_aggregation$user_def -- GitLab From f37c674ead6099200de770e2fd1b4f2d2d003ad4 Mon Sep 17 00:00:00 2001 From: vagudets Date: Fri, 25 Oct 2024 16:59:42 +0200 Subject: [PATCH 4/4] put info() call inside ifTRUE() --- modules/Aggregation/Aggregation.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Aggregation/Aggregation.R b/modules/Aggregation/Aggregation.R index 30bf4fa3..15e4ec39 100644 --- a/modules/Aggregation/Aggregation.R +++ b/modules/Aggregation/Aggregation.R @@ -56,6 +56,8 @@ Aggregation <- function(recipe, data) { stop("Time_aggregation$user_def is not a list") } } + info(recipe$Run$logger, + "##### TIME AGGREGATION COMPLETE #####") return(res) } else { warn(recipe$Run$logger, @@ -64,6 +66,4 @@ Aggregation <- function(recipe, data) { "The data is returned unchanged.")) return(data) } - info(recipe$Run$logger, - "##### TIME AGGREGATION COMPLETE #####") } -- GitLab