From 1bedb47acf4df2fcc4b3fbabedce107b0adbe4d3 Mon Sep 17 00:00:00 2001 From: JTPetter <61797391+JTPetter@users.noreply.github.com> Date: Sat, 7 Dec 2024 19:36:04 +0100 Subject: [PATCH] Update R/processCapabilityStudies.R Co-authored-by: Don van den Bergh --- R/processCapabilityStudies.R | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/R/processCapabilityStudies.R b/R/processCapabilityStudies.R index 927c03d3..401ef94b 100644 --- a/R/processCapabilityStudies.R +++ b/R/processCapabilityStudies.R @@ -2395,14 +2395,17 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { } .pcTableFormatNumbers <- function(number) { - if (all(is.na(number)) || all(is.null(number))) { + + if (is.null(number)) + return(number) + + if (all(is.na(number))) return(rep(NA, length(number))) - } + output <- formatC(number, format = "f", digits = .numDecimals) output <- sub("\\.?0+$", "", output) - if (any(is.na(number)) || any(is.null(number))) { - naNumbers <- which(is.na(number) | is.null(number)) - output[naNumbers] <- NA - } + if (anyNA(number)) + output[is.na(number)] <- NA + return(output) }