https://github.com/wlandau/remakeinpackage
Tests if github.com/richfitz/remake plays nicely with reproducible workflows implemented as R packages.
https://github.com/wlandau/remakeinpackage
Last synced: about 1 month ago
JSON representation
Tests if github.com/richfitz/remake plays nicely with reproducible workflows implemented as R packages.
- Host: GitHub
- URL: https://github.com/wlandau/remakeinpackage
- Owner: wlandau
- Created: 2016-05-18T23:07:44.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2020-10-27T16:22:21.000Z (over 4 years ago)
- Last Synced: 2025-02-14T12:40:54.234Z (3 months ago)
- Language: R
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This R package encapsulates a toy workflow. I created it to test if the [`remake`](https://github.com/richfitz/remake) package plays nicely with workflows implemented as R packages. Use `devtools::install_github()` to install.
# The workflow
The workflow generates some data, processes the data, and makes a plot. In terms of functions in R/code.R, the workflow does the following.
```
wrapper_function() # calls generate_data()
processed <- process_data("data.csv")
pdf("plot.pdf")
myplot(processed)
dev.off()
```I would like to run the workflow using [`remake`](https://github.com/richfitz/remake). I use the following `remake.yml`
```
sources:
- remakeLoadPackge.Rtargets:
all:
depends: plot.pdfdata.csv:
command: wrapper_function()processed:
command: process_data("data.csv")plot.pdf:
command: myplot(processed)
plot: true```
with `remakeLoadPackage.R` below
```
library(remakeInPackage)
```which I would like to keep short since I want to rely on my package to define the elements of the workflow.
# The results
After building and installing `remkeInPackage` and putting `remake.yml` and `remakeLoadPackage.R` in my current working directory, a call to `remake::make()` completes normally.
```
> library(remake)
> make()
[ LOAD ]
[ READ ] | # loading sources
< MAKE > all
[ BUILD ] data.csv | wrapper_function()
[ READ ] | # loading packages
[ BUILD ] processed | processed <- process_data("data.csv")
[ PLOT ] plot.pdf | myplot(processed) # ==> plot.pdf
[ ----- ] all
```But when I modify the contents of `remakeInPackage::generate_data()`, rebuild and resintall `remakeInPackage`, open a new R session, and then call `remake::make()`, the output files are not remade.
```
> make()
< MAKE > all
[ OK ] data.csv
[ OK ] processed
[ OK ] plot.pdf
[ ----- ] all
```I would like a remake to be triggered here.