From 68bea69a23e03db56ca963a0972d20c5327d358a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:16:16 +0100 Subject: [PATCH] feat: checkmate support in order --- R/order.R | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/R/order.R b/R/order.R index 43ea130d..70ffbfbf 100644 --- a/R/order.R +++ b/R/order.R @@ -72,6 +72,14 @@ xportr_order <- function(.df, ) metadata <- metacore } + assert( + combine = "or", + check_r6(metadata, "Metacore", null.ok = TRUE), + check_data_frame(metadata, null.ok = TRUE) + ) + assert_string(domain, null.ok = TRUE) + assert_choice(verbose, choices = .internal_verbose_choices) + domain_name <- getOption("xportr.domain_name") order_name <- getOption("xportr.order_name") variable_name <- getOption("xportr.variable_name") @@ -82,12 +90,13 @@ xportr_order <- function(.df, if (!is.null(domain)) attr(.df, "_xportr.df_arg_") <- domain ## End of common section + assert_data_frame(.df) # deferred after `enexpr` call metadata <- metadata %||% attr(.df, "_xportr.df_metadata_") %||% rlang::abort("Metadata must be set with `metadata` or `xportr_metadata()`") - if (inherits(metadata, "Metacore")) { + if (test_r6(metadata, "Metacore")) { metadata <- metadata$ds_vars }