From 1f443cae9c7e9282bc2e835f92925f628a4d5c85 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 11 Jan 2024 10:41:27 +0100 Subject: [PATCH] Refactor --- R/utils.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/utils.R b/R/utils.R index 82b2a96..e6e9f13 100644 --- a/R/utils.R +++ b/R/utils.R @@ -4,9 +4,9 @@ set_maplibre_class <- function(.obj, class_name) { } rdantic <- function(.obj, types, test = 1L) { - for (i in 1:length(.obj)) { - type_check <- types[[i]] - value <- .obj[[i]] + for (k in names(.obj)) { + type_check <- types[[k]] + value <- .obj[[k]] if (xor(!type_check(value), is.null(value))) { stop(value, " is not ", deparse(substitute(type_check)) , call.=FALSE) }