sowsear: Generate Knitr File from an R Script

Description Usage Arguments Value Note Author(s) See Also Examples

Description

Generate a Knitr file (silk) from an R script (a sow's ear, usually). This takes a R script and generates a Rnw (R + LaTeX) or Rmd (R + Markdown) file. Sections of the file with exactly two leading hashes are converted to "markup" (documentation sections), code is evaluated, and sections beginning "##+" are options for code chunks. Sections with three or more hashes ("###") are ignored.

Usage

1
sowsear(script, type="Rmd", output=NULL)

Arguments

script

An R script file.

type

If specified, either "Rnw" or "Rmd", indicating the required conversion target. If not specified, this is guessed from the extension of output.

output

An output file name. If not given, it is constructed from the input file name and the conversion type. If neither output nor type are given, output will be an Rmd file with the same base name as script.

Value

Invisible TRUE on success.

Note

Currently, the Sweave version assumes your document is standalone. It probably should offer a template, like knitr's stitch.

Author(s)

Richard G. FitzJohn

See Also

knit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
file.copy(system.file("sowsear-example.R", package="sowsear"),
          ".", overwrite=FALSE)

sowsear("sowsear-example.R", "Rmd")

knit("sowsear-example.Rmd")

system("pandoc -s -S -i -o sowsear-example.html sowsear-example.md")

file.remove(sprintf("sowsear-example.

## End(Not run)

richfitz/sowsear documentation built on May 27, 2019, 8:42 a.m.