-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interactive interface (avoiding yaml) #20
Comments
The idea for syntax above does not work so well in the case of plots:
just looks weird. With a custom replacement/complex assignment function it might be possible to do something like
but there's a lot of syntax there. The simplest case is still:
which could map to
|
Mildly nicer: m <- maker(NULL)
m$add <- "package:testthat"
m$add <- "code.R"
m$add <- target("data.csv", download_data(target_name),
cleanup_level="purge")
m$add <- target("processed", process_data("data.csv"))
m$add <- target("plot.pdf", myplot(processed),
plot=list(width=8, height=4))
m$make("plot.pdf") At the same time, I'm working on "links" that bind maker-controlled objects into an environment as read-only variables that fetch the appropriate thing (all offline at the moment). |
Something like this would be doable (but with a bit more effort) and might be really nice:
|
Hi there, I'm amazed to find that your last comment describes exactly what I had on my "one could propose that improval"-list. (So, 👍) One last mutation of the idea: maybe it'd be nice to just introduce a library(testthat)
source("code.R")
file("data.csv", cleanup_level="purge") <- download_data(target_name)
processed <- process_data("data.csv")
plot("plot.pdf", width=8, height=4) <- myplot(processed) It'd give us better IDE support than wrangling strings in YAML, too. Just a thought. Thanks for your work on this library, it greatly affected my workflow ;) |
I think a nice addition to interactivity would be a way to take an inventory of the |
@wlandau are you aware of |
Probably also worth noting that I walked back on the implementation of interactivity I first thought about and removed it (might be in the refactor branch?) |
@fmichonneau I was not aware of
|
Why not just: library(testthat)
source("code.R")
download_data("data.csv") # cleanup_level: purge
processed <- process_data("data.csv")
myplot(processed) # plot: "plot.pdf", width=8, height=4 This should give roughly the same results both inside and outside of |
It should be possible to run maker directly from an .R file, rather than going through yaml: all the yaml is doing is holding lists of things. Something like
or
should work fairly well and don't look too horrible (both include the assignment symbol which I think is probably important). Doing this could also allow for loops over files, etc, but that will require some extra glue to do variable substitution.
We could also arrange to do this in "global mode" where creating a target will also create either a delayed assignment or active binding function.
The text was updated successfully, but these errors were encountered: