EVOLUTION-MANAGER
Edit File: opts_hooks.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: Hooks for code chunk options</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 opts_hooks {knitr}"><tr><td>opts_hooks {knitr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Hooks for code chunk options</h2> <h3>Description</h3> <p>Like <code><a href="knit_hooks.html">knit_hooks</a></code>, this object can be used to set hook functions to manipulate chunk options. </p> <h3>Usage</h3> <pre> opts_hooks </pre> <h3>Format</h3> <p>An object of class <code>list</code> of length 6. </p> <h3>Details</h3> <p>For every code chunk, if the chunk option named, say, <code>FOO</code>, is not <code>NULL</code>, and a hook function with the same name has been set via <code>opts_hooks$set(FOO = function(options) { options })</code> (you can manipuate the <code>options</code> argument in the function and return it), the hook function will be called to update the chunk options. </p> <h3>References</h3> <p><a href="https://yihui.org/knitr/hooks/">https://yihui.org/knitr/hooks/</a> </p> <h3>Examples</h3> <pre> # make sure the figure width is no smaller than fig.height opts_hooks$set(fig.width = function(options) { if (options$fig.width < options$fig.height) { options$fig.width = options$fig.height } options }) # remove all hooks opts_hooks$restore() </pre> <hr /><div style="text-align: center;">[Package <em>knitr</em> version 1.29 <a href="00Index.html">Index</a>]</div> </body></html>