From 35b6ab77388e4bc3b479db4c179b8c9aa15948c2 Mon Sep 17 00:00:00 2001 From: Danielle Callan Date: Tue, 30 Apr 2024 15:37:22 -0400 Subject: [PATCH] continue to improve messaging --- R/method-correlation.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/R/method-correlation.R b/R/method-correlation.R index 04312aa..5c19fc1 100644 --- a/R/method-correlation.R +++ b/R/method-correlation.R @@ -114,11 +114,17 @@ function( if (!identical(veupathUtils::findNumericCols(data1), names(data1))) { warning("All columns in data1 are not numeric. Only numeric columns will be used.") keepCols <- veupathUtils::findNumericCols(data1) + if (length(keepCols) == 0) { + stop("No numeric columns found in data1.") + } data1 <- data1[, ..keepCols] } if (!identical(veupathUtils::findNumericCols(data2), names(data2))) { warning("All columns in data2 are not numeric. Only numeric columns will be used.") keepCols <- veupathUtils::findNumericCols(data2) + if (length(keepCols) == 0) { + stop("No numeric columns found in data2.") + } data2 <- data2[, ..keepCols] } @@ -186,6 +192,9 @@ function( if (!identical(veupathUtils::findNumericCols(data1), names(data1))) { warning("All columns in data1 are not numeric. Only numeric columns will be used.") keepCols <- veupathUtils::findNumericCols(data1) + if (length(keepCols) == 0) { + stop("No numeric columns found in data1.") + } data1 <- data1[, ..keepCols] }