From b1f94385b0a6b79d9383613bbf77881b37e65b3b Mon Sep 17 00:00:00 2001 From: Schultheis Date: Thu, 21 Mar 2019 14:51:02 +0100 Subject: [PATCH] clarion: print warning if there are multiple unique_ids; only use first unique_id --- R/clarion.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/clarion.R b/R/clarion.R index 15e3e1a..3c6e1e3 100644 --- a/R/clarion.R +++ b/R/clarion.R @@ -56,7 +56,7 @@ Clarion <- R6::R6Class("Clarion", # return unique_id # if no type return first feature if (is.element("type", names(self$metadata))) { - return(self$metadata[type == "unique_id"][["key"]]) + return(self$metadata[type == "unique_id"][["key"]][1]) } else { return(self$metadata[level == "feature"][["key"]][1]) } @@ -201,6 +201,10 @@ Clarion <- R6::R6Class("Clarion", if (!is.element("unique_id", self$metadata[["type"]])) { stop("Metadata: No unique_id defined in type! Please define a unique_id.") } + # case: multiple unique_ids + if (sum(is.element(self$metadata[["type"]], "unique_id")) > 1) { + warning("Metadata: Found multiple unique_ids! Only first will be used.") + } # case: type = array but no delimiter if (is.element("array", self$metadata[["type"]]) && !is.element("delimiter", names(self$header))) { stop("Found type=array but no delimiter! Columns with multi-value fields require delimiter (in header) and type=array (in metadata).")