https://github.com/beerda/rmake
Makefile generator for analytical projects in R
https://github.com/beerda/rmake
makefile r rmake
Last synced: 5 months ago
JSON representation
Makefile generator for analytical projects in R
- Host: GitHub
- URL: https://github.com/beerda/rmake
- Owner: beerda
- Created: 2018-01-22T08:34:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-30T09:06:32.000Z (almost 3 years ago)
- Last Synced: 2024-08-13T07:11:13.204Z (8 months ago)
- Topics: makefile, r, rmake
- Language: R
- Homepage:
- Size: 269 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - beerda/rmake - Makefile generator for analytical projects in R (R)
README
[](https://travis-ci.org/beerda/rmake) [](https://ci.appveyor.com/project/beerda/rmake) [](https://codecov.io/gh/beerda/rmake) [](https://cran.r-project.org/package=rmake)
rmake
=====Makefile generator for R analytical projects
Installation
------------To install *rmake*, simply issue the following command within your R session:
``` r
install.packages("devtools")
library(devtools)
devtools::install_github("beerda/rmake")
```Setup
-----The package requires the ```R_HOME``` environment variable to be properly set.
Basic Usage
-----------Suppose you have a file ```dataset.csv```. You want to pre-process it and store the results into ```dataset.rds```
within the ```preprocess.R``` R script. After that, ```dataset.rds``` is then an input file for
```report.Rmd``` and ```details.Rmd```, which are R-Markdown scripts that generate ```report.pdf``` and
```details.pdf```. The whole project can be initialized with *rmake* as follows:1. Let us assume that you have *rmake* package as well as the ```make``` tool properly installed.
2. Create a new directory (or an R studio project) and copy your ```dataset.csv``` into it.
3. Load *rmake* and create skeleton files for *rmake*:
``` r
library(rmake)
rmakeSkeleton('.')
```
```Makefile.R``` and ```Makefile``` will be created.
4. Create your file ```preprocess.R```, ```report.Rmd``` and ```details.Rmd```.
5. Edit ```Makefile.R``` as follows:
``` r
library(rmake)
job <- c('dataset.csv' %>>% rRule('preprocess.R') %>>% 'dataset.rds' %>>% markdownRule('report.Rmd') %>>% 'report.pdf',
'dataset.rds' %>>% markdownRule('details.Rmd') %>>% 'details.pdf')
)
makefile(job, 'Makefile')
```
This will create three build rules: processing of ```preprocess.R``` and execution of ```report.Rmd``` and ```details.Rmd```
in order to generate resulting PDF files.
6. Run ```make``` or build your project in R Studio (Build/Build all). This will automatically re-generate ```Makefile```
and execute ```preprocess.R``` and the generation of ```report.Rmd``` and ```details.Rmd``` accordingly to the changes
made to source files.Advanced Usage
--------------Coming soon.