drender.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <!-- Generated by pkgdown: do not edit by hand -->
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>Render Dockerized R Markdown Documents — drender • liftr</title>
  9. <!-- jquery -->
  10. <script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script>
  11. <!-- Bootstrap -->
  12. <link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/lumen/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
  13. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  14. <!-- Font Awesome icons -->
  15. <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
  16. <!-- pkgdown -->
  17. <link href="../pkgdown.css" rel="stylesheet">
  18. <script src="../jquery.sticky-kit.min.js"></script>
  19. <script src="../pkgdown.js"></script>
  20. <!-- mathjax -->
  21. <script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
  22. <!--[if lt IE 9]>
  23. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  24. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  25. <![endif]-->
  26. <!-- Google analytics -->
  27. <script>
  28. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  29. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  30. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  31. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  32. ga('create', 'UA-65001771-1', 'auto');
  33. ga('send', 'pageview');
  34. </script>
  35. </head>
  36. <body>
  37. <div class="container template-reference-topic">
  38. <header>
  39. <div class="navbar navbar-default navbar-fixed-top" role="navigation">
  40. <div class="container">
  41. <div class="navbar-header">
  42. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
  43. <span class="icon-bar"></span>
  44. <span class="icon-bar"></span>
  45. <span class="icon-bar"></span>
  46. </button>
  47. <a class="navbar-brand" href="../index.html">liftr</a>
  48. </div>
  49. <div id="navbar" class="navbar-collapse collapse">
  50. <ul class="nav navbar-nav">
  51. <li>
  52. <a href="../reference/index.html">Reference</a>
  53. </li>
  54. <li>
  55. <a href="../articles/index.html">Articles</a>
  56. </li>
  57. <li>
  58. <a href="../news/index.html">News</a>
  59. </li>
  60. </ul>
  61. <ul class="nav navbar-nav navbar-right">
  62. <li>
  63. <a href="https://github.com/road2stat/liftr">
  64. <span class="fa fa-github fa-lg"></span>
  65. </a>
  66. </li>
  67. </ul>
  68. </div><!--/.nav-collapse -->
  69. </div><!--/.container -->
  70. </div><!--/.navbar -->
  71. </header>
  72. <div class="row">
  73. <div class="col-md-9 contents">
  74. <div class="page-header">
  75. <h1>Render Dockerized R Markdown Documents</h1>
  76. </div>
  77. <p>Render dockerized R Markdown documents using Docker containers.</p>
  78. <pre><span class='fu'>drender</span>(<span class='kw'>input</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>tag</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>build_args</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
  79. <span class='kw'>container_name</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>no_cache</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>output_yaml</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='no'>...</span>)</pre>
  80. <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2>
  81. <table class="ref-arguments">
  82. <colgroup><col class="name" /><col class="desc" /></colgroup>
  83. <tr>
  84. <th>input</th>
  85. <td><p>Input file to render in Docker container.</p></td>
  86. </tr>
  87. <tr>
  88. <th>tag</th>
  89. <td><p>Docker image name to build, sent as docker argument <code>-t</code>.
  90. If not specified, it will use the same name as the input file.</p></td>
  91. </tr>
  92. <tr>
  93. <th>build_args</th>
  94. <td><p>A character string specifying additional
  95. <code>docker build</code> arguments. For example,
  96. <code>--pull=true -m="1024m" --memory-swap="-1"</code>.</p></td>
  97. </tr>
  98. <tr>
  99. <th>container_name</th>
  100. <td><p>Docker container name to run.
  101. If not specified, will use a randomly generated name.</p></td>
  102. </tr>
  103. <tr>
  104. <th>no_cache</th>
  105. <td><p>Logical. Controls the <code>--no-cache</code> argument
  106. in <code>docker run</code>. Setting this to be <code>TRUE</code> can accelerate
  107. the rendering speed substantially for repeated compilation since
  108. most of the Docker image layers will be cached, with only the
  109. changed (knitr related) image layer being updated.
  110. Default is <code>TRUE</code>.</p></td>
  111. </tr>
  112. <tr>
  113. <th>...</th>
  114. <td><p>Additional arguments passed to
  115. <code><a href='http://www.rdocumentation.org/packages/rmarkdown/topics/render'>render</a></code>.</p></td>
  116. </tr>
  117. <tr>
  118. <th>purge_info</th>
  119. <td><p>Logical. Should we write the Docker container and
  120. image information to a YAML file for purging later?
  121. Default is <code>TRUE</code>.</p></td>
  122. </tr>
  123. </table>
  124. <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
  125. <p>Rendered file is written to the same directory of the input file.
  126. A character vector with the image name and container name will be
  127. returned. You will be able to manage them with <code>docker</code>
  128. commands later or with the cleanup functions.</p>
  129. <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
  130. <p>Before using <code>drender()</code>, run <a href='lift.html'>lift</a> on the RMD document
  131. first to generate the <code>Dockerfile</code>.</p>
  132. <p>See <code><a href='../articles/liftr-intro.html'>vignette('liftr-intro')</a></code> for details about the extended
  133. YAML front-matter metadata format and system requirements for
  134. rendering dockerized R Markdown documents.</p>
  135. <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
  136. <pre class="examples"><div class='input'><span class='co'># copy example file</span>
  137. <span class='no'>dir_example</span> <span class='kw'>=</span> <span class='fu'>paste0</span>(<span class='fu'>tempdir</span>(), <span class='st'>'/liftr-minimal/'</span>)
  138. <span class='fu'>dir.create</span>(<span class='no'>dir_example</span>)
  139. <span class='fu'>file.copy</span>(<span class='fu'>system.file</span>(<span class='st'>"examples/liftr-minimal.Rmd"</span>, <span class='kw'>package</span> <span class='kw'>=</span> <span class='st'>"liftr"</span>), <span class='no'>dir_example</span>)</div><div class='output co'>#&gt; [1] TRUE</div><div class='input'>
  140. <span class='co'># containerization</span>
  141. <span class='no'>input</span> <span class='kw'>=</span> <span class='fu'>paste0</span>(<span class='no'>dir_example</span>, <span class='st'>"liftr-minimal.Rmd"</span>)
  142. <span class='fu'><a href='lift.html'>lift</a></span>(<span class='no'>input</span>)
  143. <span class='co'>## Not run: ------------------------------------</span>
  144. <span class='co'># # render the document with Docker</span>
  145. <span class='co'># drender(input)</span>
  146. <span class='co'># </span>
  147. <span class='co'># # view rendered document</span>
  148. <span class='co'># browseURL(paste0(dir_example, "liftr-minimal.html"))</span>
  149. <span class='co'># </span>
  150. <span class='co'># # purge the generated Docker image</span>
  151. <span class='co'># purge_image(paste0(dir_example, "liftr-minimal.docker.yml"))</span>
  152. <span class='co'>## ---------------------------------------------</span></div></pre>
  153. </div>
  154. <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
  155. <h2>Contents</h2>
  156. <ul class="nav nav-pills nav-stacked">
  157. <li><a href="#arguments">Arguments</a></li>
  158. <li><a href="#value">Value</a></li>
  159. <li><a href="#details">Details</a></li>
  160. <li><a href="#examples">Examples</a></li>
  161. </ul>
  162. </div>
  163. </div>
  164. <footer>
  165. <div class="copyright">
  166. <p>Developed by Nan Xiao.</p>
  167. </div>
  168. <div class="pkgdown">
  169. <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p>
  170. </div>
  171. </footer>
  172. </div>
  173. </body>
  174. </html>