Build R project using Make
My default for building projects is to use make . I find it helps organise a projects workflow, even if there are other build tools available. It is succinct, and descriptive. A previous post showed how you can use make to build Haskell projects using GHC, Cabal and Stack. This blog show how to do the same for R projects. Below is an R script that can be used to render R markdown to PDF. It is invoked from a parent Makefile which is what is read when you call make. make.R #!/usr/bin/env R # Render R markdown to PDF. # Invoke with: # > R -q -f make.R --args my_report.Rmd # load packages require ( rmarkdown ) # require a parameter naming file to render if ( length ( args ) == 0 ) { stop ( "Error: missing file operand" , call. = TRUE ) } else { # read report to render from command line for ( rmd in commandArgs ( trailingOnly = TRUE ) ) { # render Rmd to PDF if ( grepl ( " \\ .Rmd$" , rmd ) &...