-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
featurea feature request or enhancementa feature request or enhancement
Description
I noticed that workflowsets does not appear to have a method for collecting extracts and it has a method for collecting notes #135.
class(results)
[1] "workflow_set" "tbl_df" "tbl" "data.frame"
collect_extracts(results)
Error incollect_extracts()
:
! Nocollect_extracts()
exists for a <workflow_set/tbl_df/tbl/data.frame> object.
Runrlang::last_trace()
to see where the error occurred.
It would be handy to have collect_extracts implemented so that you can get elapsed time or other information extracted.
Here one example using partials if you want to reuse the code for mulitple collect_*
my_collect_custom <- function(wflow_set_results, fn){
wflow_set_rsl <- wflow_set_results %>%
dplyr::select(wflow_id, result)
distinct_list_of_workflows <- wflow_set_rsl %>%
dplyr::select(wflow_id) %>%
distinct() %>%
pull(wflow_id)
collect_fn_helper <- function(x){
wflow_set_rsl %>%
filter(wflow_id == x) %>%
pull(result) %>%
pluck(1) %>%
fn()
}
list_dfs <- map_dfr(
set_names(distinct_list_of_workflows),
collect_fn_helper,
.id = "workflow_id")
list_dfs
}
my_collect_extracts <- purrr::partial(my_collect_custom, fn = collect_extracts)
my_collect_extracts(results)
my_collect_notes <- purrr::partial(my_collect_custom, fn = collect_notes)
my_collect_notes(results)
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancement