Passing a string to tar_read? #354
-
I'm probably misusing things somewhere, but I'm playing with the excellent stantargets with a static branching pattern to explore multiple models under different data size conditions, and I can get the list of resulting targets by filtering the metadata, but I'm having trouble then programatically retrieving the corresponding objects using (
tar_meta()
%>% filter(
type=='pattern'
, !str_contains(name,'_data')
)
%>% pull(name)
#works up to here
# %>% map_dfr( .f = tar_read ) #doesn't work
# %>% map_dfr( .f = tar_read(!!.) ) #doesn't work
# %>% map_dfr( .f = function(x) { tar_read(!!x) } ) #doesn't work
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
envir <- new.env()
tar_load(ends_with("_data"), envir = envir)
as.list(envir) |
Beta Was this translation helpful? Give feedback.
tar_read_raw()
can accept a string. Alternatively,tar_load()
acceptstidyselect
syntax. To create a list usingtar_load()
: