Skip to content

Commit

Permalink
Allow checks to proceed with NAs (#96)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
AlexAxthelm and cjyetman authored Jun 28, 2024
1 parent 97d2526 commit 08c0e73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/get_csv_specs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand All @@ -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")
}

Expand Down

0 comments on commit 08c0e73

Please sign in to comment.