ropensci / drake

An R-focused pipeline toolkit for reproducibility and high-performance computing
https://docs.ropensci.org/drake
GNU General Public License v3.0
1.34k stars 129 forks source link

.Rmd in packages example won't knit #418

Closed cstawitz closed 6 years ago

cstawitz commented 6 years ago

I'm planning to learn drake and then present an overview of the package to Seattle's RLadies group in a few weeks. However, I can't get the packages example working. Specifically, the markdown isn't knit because of the following issue on line 40 of report.Rmd.

> readd(averages_recent)
Error: key 'averages_recent' ('objects') not found

which then results in this error on line 136 of interactive-tutorial.R because the .md isn't created.

> make(whole_plan)
Unloading targets from environment:
  recent
target recent: trigger "always"
target file "report.md"
Warning: target "report.md" warnings:
  cannot open file 'report.Rmd': No such file or directory
fail "report.md"
Error: Target `"report.md"` failed. Call `diagnose("report.md")` for details. Error message:
  cannot open the connection
In addition: There were 14 warnings (use warnings() to see them)
wlandau commented 6 years ago

Thanks for spotting this, I will take a look as soon as I get back to my computer. drake has been developing fast lately, and I expect that the examples just need to catch up.

I am thrilled to hear about your RLadies presentation coming up! Please let me know what else I can do to help.

wlandau commented 6 years ago

Hmm... this example still works for me. Definitely worth checking though because it has been a while.

From the error log, it looks as though the file report.Rmd is missing from the root of your project. Was it missing from the packages folder generated by drake_example("packages")? In any case, the example requires you to set this folder as your working directory when you run make().

In drake, counterintuitively enough, R Markdown reports are not entirely standalone. They are just steps in the analysis, not overarching workflow managers. In this example specifically, a bunch of data processing steps need to happen before report.Rmd can be built (see the dependency graph above this section of the manual. If you use loadd() and readd() to reference targets in the active code chunks of the report, drake will know what it needs to build before trying to knit.

cstawitz commented 6 years ago

Ah yes! That was the issue. I hadn't set my working directory to the packages folder. It works fine now :)

Thanks for the quick response! And for the detailed explanation.