Skip to content

Commit

Permalink
feat: checkmate support in order
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Nov 30, 2023
1 parent b778b78 commit 68bea69
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion R/order.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
}

Expand Down

0 comments on commit 68bea69

Please sign in to comment.