From c1a4aa3a9ed5a64666367073bc28e1c70525e1ee Mon Sep 17 00:00:00 2001 From: David Klein Date: Wed, 10 Jan 2024 17:49:51 +0100 Subject: [PATCH] Add optional switch to ignore warning about separator replacement. --- R/read.report.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/read.report.R b/R/read.report.R index c074bea3..d51b9e60 100644 --- a/R/read.report.R +++ b/R/read.report.R @@ -66,7 +66,7 @@ #' @export read.report #' @importFrom utils read.table #' -read.report <- function(file, as.list = TRUE) { # nolint +read.report <- function(file, as.list = TRUE, ignoreSeparatorWarning = FALSE) { # nolint .trim <- function(a) return(gsub("(^ +)|( +$)", "", as.character(a))) @@ -85,7 +85,9 @@ read.report <- function(file, as.list = TRUE) { # nolint ndots <- nchar(gsub("[^\\.]*", "", names)) if (any(ndots != ndots[1])) { names <- gsub("\\.", "p", names) - warning("Replaced some \".\" with \"p\" to prevent misinterpretation as dim separator") + if (!ignoreSeparatorWarning) { + warning("Replaced some \".\" with \"p\" to prevent misinterpretation as dim separator") + } } # replace weird ° in tables after sub function evaluation names <- enc2utf8(names)