From 08c0e737a7f11109a3029a18fdd3fb37567d4de6 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Fri, 28 Jun 2024 14:31:28 +0200 Subject: [PATCH] Allow checks to proceed with NAs (#96) previously, having an NA in either of the affected columns would fail, as the `||` operator cannot cast NA to `logical()` Will probably get clobbered when #11 gets addressed, but works in the meantime. --------- Co-authored-by: CJ Yetman --- R/get_csv_specs.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/get_csv_specs.R b/R/get_csv_specs.R index d0e507e..eb2f269 100644 --- a/R/get_csv_specs.R +++ b/R/get_csv_specs.R @@ -193,7 +193,7 @@ get_csv_specs <- function(files, expected_colnames = c("Investor.Name", "Portfol if (all(!is.na(files_df$decimal_mark)) && all(files_df$decimal_mark == ".")) { cli::cli_alert_success(paste0("all files use {.strong ", cli::style_inverse("."), "} for a decimal mark")) } else { - alert_files <- files_df$filename[is.na(files_df$decimal_mark) || grepl("^[.]$", files_df$decimal_mark)] + alert_files <- files_df$filename[is.na(files_df$decimal_mark) | grepl("^[.]$", files_df$decimal_mark)] report_alert_files(paste0("the following files do not use {.strong ", cli::style_inverse("."), "} for a decimal mark"), alert_files, type = "warning", info = "this can be adapted to automatically by the {.fun read_portfolio_csv} function") } @@ -202,7 +202,7 @@ get_csv_specs <- function(files, expected_colnames = c("Investor.Name", "Portfol if (all(!is.na(files_df$grouping_mark)) && all(files_df$grouping_mark == ",")) { cli::cli_alert_success(paste0("all files use {.strong ", cli::style_inverse(","), "} for a grouping mark")) } else { - alert_files <- files_df$filename[is.na(files_df$grouping_mark) || grepl("^[,]$", files_df$grouping_mark)] + alert_files <- files_df$filename[is.na(files_df$grouping_mark) | grepl("^[,]$", files_df$grouping_mark)] report_alert_files(paste0("the following files do not use {.strong ", cli::style_inverse(","), "} for a grouping mark"), alert_files, type = "warning", info = "this can be adapted to automatically by the {.fun read_portfolio_csv} function") }