EVOLUTION-MANAGER
Edit File: asis_output.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: Mark an R object with a special class</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 asis_output {knitr}"><tr><td>asis_output {knitr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Mark an R object with a special class</h2> <h3>Description</h3> <p>This is a convenience function that assigns the input object a class named <code>knit_asis</code>, so that <span class="pkg">knitr</span> will treat it as is (the effect is the same as the chunk option <code>results = 'asis'</code>) when it is written to the output. </p> <h3>Usage</h3> <pre> asis_output(x, meta = NULL, cacheable = NA) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>An R object. Typically a character string, or an object which can be converted to a character string via <code><a href="../../base/html/character.html">as.character</a>()</code>.</p> </td></tr> <tr valign="top"><td><code>meta</code></td> <td> <p>Additional metadata of the object to be printed. The metadata will be collected when the object is printed, and accessible via <code>knit_meta()</code>.</p> </td></tr> <tr valign="top"><td><code>cacheable</code></td> <td> <p>Boolean indicating whether this object is cacheable. If <code>FALSE</code>, <span class="pkg">knitr</span> will stop when caching is enabled on code chunks that contain <code>asis_output()</code>.</p> </td></tr> </table> <h3>Details</h3> <p>This function is normally used in a custom S3 method based on the printing function <code><a href="knit_print.html">knit_print</a>()</code>. </p> <p>For the <code>cacheable</code> argument, you need to be careful when printing the object involves non-trivial side effects, in which case it is strongly recommended to use <code>cacheable = FALSE</code> to instruct <span class="pkg">knitr</span> that this object should not be cached using the chunk option <code>cache = TRUE</code>, otherwise the side effects will be lost the next time the chunk is knitted. For example, printing a <span class="pkg">shiny</span> input element or an HTML widget in an R Markdown document may involve registering metadata about some JavaScript libraries or stylesheets, and the metadata may be lost if we cache the code chunk, because the code evaluation will be skipped the next time. This particular issue has been solved in <span class="pkg">knitr</span> after v1.13 (the metadata will be saved and loaded automatically when caching is enabled), but not all metadata can be saved and loaded next time and still works in the new R session. </p> <h3>Note</h3> <p>This function only works in top-level R expressions, and it will not work when it is called inside another expression, such as a for-loop. See <a href="https://github.com/yihui/knitr/issues/1137">https://github.com/yihui/knitr/issues/1137</a> for a discussion. </p> <h3>Examples</h3> <pre> # see ?knit_print </pre> <hr /><div style="text-align: center;">[Package <em>knitr</em> version 1.29 <a href="00Index.html">Index</a>]</div> </body></html>