From 2d875e98491f20f68a8ea0c4176d223b4de265f5 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Fri, 28 Jun 2024 12:53:31 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: CJ Yetman --- R/get_csv_specs.R | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/R/get_csv_specs.R b/R/get_csv_specs.R index 7ae1afa..eb2f269 100644 --- a/R/get_csv_specs.R +++ b/R/get_csv_specs.R @@ -193,10 +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 <- c( - files_df$filename[is.na(files_df$decimal_mark)], - files_df$filename[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") } @@ -205,10 +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 <- c( - files_df$filename[is.na(files_df$grouping_mark)], - files_df$filename[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") }