EVOLUTION-MANAGER
Edit File: spin.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Spin goat's hair into wool</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for spin {knitr}"><tr><td>spin {knitr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Spin goat's hair into wool</h2> <h3>Description</h3> <p>This function takes a specially formatted R script and converts it to a literate programming document. By default normal text (documentation) should be written after the roxygen comment (<code>#'</code>) and code chunk options are written after <code>#+</code> or <code>#-</code> or <code># ----</code> or any of these combinations replacing <code>#</code> with <code>--</code>. </p> <h3>Usage</h3> <pre> spin( hair, knit = TRUE, report = TRUE, text = NULL, envir = parent.frame(), format = c("Rmd", "Rnw", "Rhtml", "Rtex", "Rrst"), doc = "^#+'[ ]?", inline = "^[{][{](.+)[}][}][ ]*$", comment = c("^[# ]*/[*]", "^.*[*]/ *$"), precious = !knit && is.null(text) ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>hair</code></td> <td> <p>Path to the R script. The script must be encoded in UTF-8 if it contains multibyte characters.</p> </td></tr> <tr valign="top"><td><code>knit</code></td> <td> <p>Logical; whether to compile the document after conversion.</p> </td></tr> <tr valign="top"><td><code>report</code></td> <td> <p>Logical; whether to generate a report for ‘<span class="file">Rmd</span>’, ‘<span class="file">Rnw</span>’ and ‘<span class="file">Rtex</span>’ output. Ignored if <code>knit = FALSE</code>.</p> </td></tr> <tr valign="top"><td><code>text</code></td> <td> <p>A character vector of code, as an alternative way to provide the R source. If <code>text</code> is not <code>NULL</code>, <code>hair</code> will be ignored.</p> </td></tr> <tr valign="top"><td><code>envir</code></td> <td> <p>Environment for <code><a href="knit.html">knit</a>()</code> to evaluate the code.</p> </td></tr> <tr valign="top"><td><code>format</code></td> <td> <p>Character; the output format. The default is R Markdown.</p> </td></tr> <tr valign="top"><td><code>doc</code></td> <td> <p>A regular expression to identify the documentation lines; by default it follows the roxygen convention, but it can be customized, e.g. if you want to use <code>##</code> to denote documentation, you can use <code>'^##\\s*'</code>.</p> </td></tr> <tr valign="top"><td><code>inline</code></td> <td> <p>A regular expression to identify inline R expressions; by default, code of the form <code>{{code}}</code> on its own line is treated as an inline expression.</p> </td></tr> <tr valign="top"><td><code>comment</code></td> <td> <p>A pair of regular expressions for the start and end delimiters of comments; the lines between a start and an end delimiter will be ignored. By default, the delimiters are <code style="white-space: pre;">/*</code> at the beginning of a line, and <code style="white-space: pre;">*/</code> at the end, following the convention of C comments.</p> </td></tr> <tr valign="top"><td><code>precious</code></td> <td> <p>logical: whether intermediate files (e.g., <code>.Rmd</code> files when <code>format</code> is <code>"Rmd"</code>) should be preserved. The default is <code>FALSE</code> if <code>knit</code> is <code>TRUE</code> and the input is a file.</p> </td></tr> </table> <h3>Details</h3> <p>Obviously the goat's hair is the original R script, and the wool is the literate programming document (ready to be knitted). </p> <h3>Value</h3> <p>If <code>text</code> is <code>NULL</code>, the path of the final output document, otherwise the content of the output. </p> <h3>Note</h3> <p>If the output format is Rnw and no document class is specified in roxygen comments, this function will automatically add the <code>article</code> class to the LaTeX document so that it is complete and can be compiled. You can always specify the document class and other LaTeX settings in roxygen comments manually. </p> <p>When the output format is Rmd, it is compiled to HTML via <code><a href="knit2html.html">knit2html</a>()</code>, which uses R Markdown v1 instead of v2. If you want to use the latter, you should call <code>rmarkdown::<a href="../../rmarkdown/html/render.html">render</a>()</code> instead. </p> <h3>Author(s)</h3> <p>Yihui Xie, with the original idea from Richard FitzJohn (who named it as <code>sowsear()</code> which meant to make a silk purse out of a sow's ear) </p> <h3>References</h3> <p><a href="https://yihui.org/knitr/demo/stitch/">https://yihui.org/knitr/demo/stitch/</a> </p> <h3>See Also</h3> <p><code><a href="stitch.html">stitch</a></code> (feed a template with an R script) </p> <hr /><div style="text-align: center;">[Package <em>knitr</em> version 1.29 <a href="00Index.html">Index</a>]</div> </body></html>