summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorRanke Johannes <johannes.ranke@agroscope.admin.ch>2026-02-13 13:45:57 +0100
committerRanke Johannes <johannes.ranke@agroscope.admin.ch>2026-02-13 13:45:57 +0100
commita59124dd18106f35e8a965bd173ab80d33ba9c84 (patch)
tree521a261375bdffb1aa5334161abee30d114fdbf0 /R
parenteeb3d14020a67d6ba0b35a493bea1a0799f0336a (diff)
Improve error message formatting
Diffstat (limited to 'R')
-rw-r--r--R/PEC_sw_drift.R8
1 files changed, 6 insertions, 2 deletions
diff --git a/R/PEC_sw_drift.R b/R/PEC_sw_drift.R
index 413388c..05f90dd 100644
--- a/R/PEC_sw_drift.R
+++ b/R/PEC_sw_drift.R
@@ -120,10 +120,14 @@ PEC_sw_drift <- function(rate,
drift_data <- match.arg(drift_data)
unmatched_crop_groups_JKI <- setdiff(crop_group_JKI, colnames(pfm::drift_data_JKI[[1]]))
- if (length(unmatched_crop_groups_JKI) > 0) stop("Crop group(s) ", unmatched_crop_groups_JKI, " not supported")
+ if (length(unmatched_crop_groups_JKI) > 0) {
+ stop("Crop group(s) ", paste(unmatched_crop_groups_JKI, collapse = ", "), " not supported")
+ }
unmatched_crop_groups_RF <- setdiff(crop_group_RF, unique(pfm::drift_parameters_focus$crop_group))
- if (length(unmatched_crop_groups_RF) > 0) stop("Crop group(s) ", unmatched_crop_groups_RF, " not supported")
+ if (length(unmatched_crop_groups_RF) > 0) {
+ stop("Crop group(s) ", paste(unmatched_crop_groups_RF, collapse = ", "), "not supported")
+ }
if (drift_data == "JKI" & crop_group_RF[1] != "arable") {
stop("Specifying crop_group_RF only makes sense if 'RF' is used for 'drift_data'")

Contact - Imprint