Description Usage Arguments Details
Determine targets and prerequisites based on data files that are read/written in your working directory. Make targets by running scripts.
1 2 3 4 |
path |
Directory containing R scripts or a single file |
script.all |
Which script produces the ultimate target? By default a script that creates targets on which nothing else depends |
read.fun |
Vector of (partial) function names; e.g. |
write.fun |
Vector of (partial) function names; e.g. |
read.arg |
Name of argument specifying the file read |
write.arg |
Name of argument specifying the file written |
script |
A named list of shell commands for specific file types |
dry |
Should a Makefile be written ( |
make_file()
will parse
the R code in 'path' and
search for function calls that read/write data files. It uses partial
matching, so if read.fun
is set to "read"
, it will match
read.delim
, read.table
, readRds
etc.
The purpose of this is to extract the values of the file
argument
from these calls and create a list of files that are being read/written.
(You can actually choose different argument but file
seems like the
most sensible default. Partial matching applies here as well so file
and xlsxFile
are both matched by "file"
.)
In order for this to work, use named file
argument in your function
calls, e.g. load(file = "myfile.RData")
and not
load("myfile.RData")
, otherwise the parser will ignore it.
Once the list of data files is obtained, a Makefile is created, using files
that were written as targets and files that were read as prerequisites.
The scripts that do the reading/writing become commands. By default, the
shell command for R files is "Rscript \"myfile.R\""
and for Rmd
files "Rscript -e \"rmarkdown::render('myfile.Rmd')\""
.
If DRY
is TRUE
, the Makefile is just printed on the console.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.