From 5d3dd57146db327a5daec6f74fdd7f81dbbf91d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20L=C3=B6ffler?= Date: Tue, 21 Nov 2023 12:48:27 +0100 Subject: [PATCH] Improve code readability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maximilian Löffler --- util-split.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util-split.R b/util-split.R index fb184b51..6c3e6601 100644 --- a/util-split.R +++ b/util-split.R @@ -67,7 +67,7 @@ split.data.time.based = function(project.data, time.period = "3 months", bins = # validate existence and type of the 'bins' parameter if (!is.null(bins) && !lubridate::is.POSIXct(bins)) { - dates = parallel::mclapply(bins, function(bin) get.date.from.string(bin)) + dates = parallel::mclapply(bins, get.date.from.string) if (any(is.na(dates))) { logging::logerror("The bins parameter, if present, needs to be a character representing a date") stop("Stopped due to incorrect parameter types") @@ -105,12 +105,12 @@ split.data.by.bins = function(project.data, activity.amount, bins, split.basis = } # validate existence and type of the 'bins' component of the 'bins' parameter - if (!"bins" %in% names(bins)) { + if (!("bins" %in% names(bins))) { logging::logerror("The 'bins' parameter needs to include a component 'bins'") stop("Stopped due to incorrect parameter types") } - dates = parallel::mclapply(bins[["bins"]], function(bin) get.date.from.string(bin)) + dates = parallel::mclapply(bins[["bins"]], get.date.from.string) if (any(is.na(dates))) { logging::logerror("The 'bins' component of the bins parameter needs to be a character representing a date") stop("Stopped due to incorrect parameter types")