I have a set of targets, lets say data_a
, data_b
, ...
I want to iterate over all datasets and load the data.
This can be achieved using tar_read(data_a)
or tar_read(data_a")
. As I want to load the targets programmatically, I would like to use something like this in some kind of lapply:
target_name <- "data_a"
data <- tar_read(target_name)
But then I get the error that the target target_name
was not found.
I know this is related to NSE with R as tar_read
internally calls substitute
, but I wasn't able to figure out how to mask the target_name
to make tar_read
work. I have tried eval(parse())
and the different options presented in Advanced R, as well as rlang (such as !!, {{ and similar) to no avail.
Any idea how to achieve this?