Why can't I use ls() in a drake R plan?

68 views Asked by At

I'm trying to list all objects/variables/dataframes in a drake plan's environment that match a certain condition. However, when I try to use ls() for this, I'm returned an error.

How could I do this instead?

1

There are 1 answers

0
landau On BEST ANSWER

drake childproofs the calling environment of make() and maintains a formal hierarchy of environments for actually evaluating code. This behavior is mostly a safeguard against side effects that could violate its functional programming assumptions (e.g. commands act like pure functions and targets are immutable). You can access drake's environments with the drake_envir() function. Unless you are using dynamic branching, you probably want ls(envir = drake_envir(which = "targets")).