richfitz / remake

Make-like declarative workflows in R
Other
340 stars 32 forks source link

FR: dep_names #103

Closed krlmlr closed 8 years ago

krlmlr commented 8 years ago

Same as the special target_name variable in rules, would contain a named list of dependencies.

Example use case: Zip multiple files.

krlmlr commented 8 years ago

One can also do it the other way round: Have remake autodetect the dependencies which are passed as string constants:

zip_fresh <- function(zip_file, ...) {
  sources <- c(...)
  unlink(zip_file)
  zip(zip_file, sources, flags = "-3jX")
}
targets:
  out.zip:
    command: zip_fresh(target_name, "file1.csv", "file2.csv")
wlandau commented 8 years ago

@krlmlr I was under the impression that remake already does this. Issue #58 explains that strings that are not dependencies must be enclosed in I(). This is actually an initial point of frustration for my new converts to remake because people expect strings to just be strings, so it would be nice if the documentation of this behavior were more obvious.

krlmlr commented 8 years ago

@wlandau: Thanks for the heads up. My last post was an alternate solution to my use case that works for me with current remake.

wlandau commented 8 years ago

@krlmlr Oh, sorry, I didn't realize you were talking about the use case specifically.