diff --git a/DESCRIPTION b/DESCRIPTION index df65ead..1c06ff3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -74,7 +74,8 @@ Imports: stringr, tibble, tidyr, - UpSetR + UpSetR, + waldo Depends: R (>= 4.2.0) LazyData: false diff --git a/R/misc.R b/R/misc.R index 2a40b95..137d1e9 100644 --- a/R/misc.R +++ b/R/misc.R @@ -224,8 +224,14 @@ dot <- function() { #' ## Export to json file #' export_steps(rec, tempfile(fileext = ".json")) export_steps <- function(rec, file_name) { + + inp <- rec@steps + if (is(rec, "prep_recipe")) { + inp <- c(rec@steps, rec@bakes) + } + to_cat <- - c(rec@steps, rec@bakes) %>% + inp %>% purrr::map_chr(~ { params <- names(.x) %>% diff --git a/R/read_data.R b/R/read_data.R index 1f15b69..b8cba65 100644 --- a/R/read_data.R +++ b/R/read_data.R @@ -61,7 +61,7 @@ read_data <- function(data_path) { taxa_df <- files %>% - purrr::discard(~ setequal(.x, counts_df)) %>% + purrr::discard(~ waldo::compare(.x, counts_df) %>% length() == 0) %>% purrr::map_dfr(~ { if (all(counts_df[[1]] %in% .x[[1]])) { .x @@ -71,8 +71,10 @@ read_data <- function(data_path) { metadata_df <- files %>% - purrr::discard(~ setequal(.x, counts_df) | - setequal(.x, taxa_df)) %>% + purrr::discard( + ~ waldo::compare(.x, counts_df) %>% length() == 0 | + waldo::compare(.x, taxa_df) %>% length() == 0 + ) %>% purrr::pluck(1) %>% validate_sample_data()