Skip to content

Commit

Permalink
fix: move assert dataframe up
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Nov 30, 2023
1 parent d59c241 commit 531f706
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/df_label.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ xportr_df_label <- function(.df,
)
metadata <- metacore
}
assert_data_frame(.df)
assert(
combine = "or",
check_r6(metadata, "Metacore", null.ok = TRUE),
Expand All @@ -67,7 +68,6 @@ xportr_df_label <- function(.df,
if (!is.null(domain)) attr(.df, "_xportr.df_arg_") <- domain

## End of common section
assert_data_frame(.df) # deferred after `enexpr` call

## Pull out correct metadata
metadata <- metadata %||%
Expand Down
2 changes: 1 addition & 1 deletion R/format.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ xportr_format <- function(.df,
)
metadata <- metacore
}
assert_data_frame(.df)
assert(
combine = "or",
check_r6(metadata, "Metacore", null.ok = TRUE),
Expand All @@ -70,7 +71,6 @@ xportr_format <- 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_") %||%
Expand Down
2 changes: 1 addition & 1 deletion R/label.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ xportr_label <- function(.df,
)
metadata <- metacore
}
assert_data_frame(.df)
assert(
combine = "or",
check_r6(metadata, "Metacore", null.ok = TRUE),
Expand All @@ -87,7 +88,6 @@ xportr_label <- 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_") %||%
Expand Down
2 changes: 1 addition & 1 deletion R/length.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ xportr_length <- function(.df,
)
metadata <- metacore
}
assert_data_frame(.df)
assert(
combine = "or",
check_r6(metadata, "Metacore", null.ok = TRUE),
Expand All @@ -94,7 +95,6 @@ xportr_length <- 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_") %||%
Expand Down
2 changes: 1 addition & 1 deletion R/metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#' xportr_order()
#' }
xportr_metadata <- function(.df, metadata, domain = NULL) {
assert_data_frame(.df)
assert(
combine = "or",
check_r6(metadata, "Metacore", null.ok = TRUE),
Expand All @@ -54,7 +55,6 @@ xportr_metadata <- function(.df, metadata, domain = NULL) {
if (!is.null(domain)) attr(.df, "_xportr.df_arg_") <- domain

## End of common section
assert_data_frame(.df) # deferred after `enexpr` call

structure(.df, "_xportr.df_metadata_" = metadata)
}
Expand Down
2 changes: 1 addition & 1 deletion R/order.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ xportr_order <- function(.df,
)
metadata <- metacore
}
assert_data_frame(.df)
assert(
combine = "or",
check_r6(metadata, "Metacore", null.ok = TRUE),
Expand All @@ -90,7 +91,6 @@ 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_") %||%
Expand Down
2 changes: 1 addition & 1 deletion R/type.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ xportr_type <- function(.df,
)
metadata <- metacore
}
assert_data_frame(.df)
assert(
combine = "or",
check_r6(metadata, "Metacore", null.ok = TRUE),
Expand All @@ -111,7 +112,6 @@ xportr_type <- function(.df,
if (!is.null(domain)) attr(.df, "_xportr.df_arg_") <- domain

## End of common section
assert_data_frame(.df) # deferred after `enexpr` call

## Pull out correct metadata
metadata <- metadata %||%
Expand Down

0 comments on commit 531f706

Please sign in to comment.