| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <!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"
- lang="en" xml:lang="en">
- <head>
- <title>testing</title>
- <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
- <meta name="generator" content="Org-mode"/>
- <meta name="generated" content="2009-02-05 15:41:29 PST"/>
- <meta name="author" content="Eric Schulte"/>
- <style type="text/css">
- <!--/*--><![CDATA[/*><!--*/
- html { font-family: Times, serif; font-size: 12pt; }
- .title { text-align: center; }
- .todo { color: red; }
- .done { color: green; }
- .tag { background-color:lightblue; font-weight:normal }
- .target { }
- .timestamp { color: grey }
- .timestamp-kwd { color: CadetBlue }
- p.verse { margin-left: 3% }
- pre {
- border: 1pt solid #AEBDCC;
- background-color: #F3F5F7;
- padding: 5pt;
- font-family: courier, monospace;
- font-size: 90%;
- overflow:auto;
- }
- table { border-collapse: collapse; }
- td, th { vertical-align: top; }
- dt { font-weight: bold; }
- div.figure { padding: 0.5em; }
- div.figure p { text-align: center; }
- .linenr { font-size:smaller }
- .code-highlighted {background-color:#ffff00;}
- .org-info-js_info-navigation { border-style:none; }
- #org-info-js_console-label { font-size:10px; font-weight:bold;
- white-space:nowrap; }
- .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
- font-weight:bold; }
- /*]]>*/-->
- </style>
- <script type="text/javascript">
- <!--/*--><![CDATA[/*><!--*/
- function CodeHighlightOn(elem, id)
- {
- var target = document.getElementById(id);
- if(null != target) {
- elem.cacheClassElem = elem.className;
- elem.cacheClassTarget = target.className;
- target.className = "code-highlighted";
- elem.className = "code-highlighted";
- }
- }
- function CodeHighlightOff(elem, id)
- {
- var target = document.getElementById(id);
- if(elem.cacheClassElem)
- elem.className = elem.cacheClassElem;
- if(elem.cacheClassTarget)
- target.className = elem.cacheClassTarget;
- }
- /*]]>*/-->
- </script>
- </head><body>
- <h1 class="title">testing</h1>
- <div id="table-of-contents">
- <h2>Table of Contents</h2>
- <div id="text-table-of-contents">
- <ul>
- <li><a href="#sec-1">1 Sweave and org-mode </a>
- <ul>
- <li><a href="#sec-1.1">1.1 Use the Sweave package for latex formatting </a></li>
- <li><a href="#sec-1.2">1.2 R blocks </a>
- <ul>
- <li><a href="#sec-1.2.1">1.2.1 R code that is not printed </a></li>
- <li><a href="#sec-1.2.2">1.2.2 R code that is printed </a></li>
- <li><a href="#sec-1.2.3">1.2.3 R code that references other blocks </a></li>
- </ul>
- </li>
- <li><a href="#sec-1.3">1.3 Inline references to R data </a>
- <ul>
- <li><a href="#sec-1.3.1">1.3.1 Used in text </a></li>
- <li><a href="#sec-1.3.2">1.3.2 Used in a table </a></li>
- </ul>
- </li>
- <li><a href="#sec-1.4">1.4 Single-line R commands </a></li>
- <li><a href="#sec-1.5">1.5 Graphics </a></li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- <div id="outline-container-1" class="outline-2">
- <h2 id="sec-1">1 Sweave and org-mode </h2>
- <div id="text-1">
- <p>If you're reading a PDF version of this document, you should also
- look at <a href="testing.Rorg">testing.Rorg</a> (the source file) and <a href="testing.html">testing.org</a> (the output
- of the Sweave process).
- </p>
- <p>
- Keep in mind that one of the advantages of a block-based approach is
- using \texttt{C-'} to edit code in its native mode.
- </p>
- </div>
- <div id="outline-container-1.1" class="outline-3">
- <h3 id="sec-1.1">1.1 Use the Sweave package for latex formatting </h3>
- <div id="text-1.1">
- <p>Org allows us to issue commands to be included in \{LaTeX} export.
- </p>
- </div>
- </div>
- <div id="outline-container-1.2" class="outline-3">
- <h3 id="sec-1.2">1.2 R blocks </h3>
- <div id="text-1.2">
- <p>The first argument to an R block when using Sweave is the label for
- that block.
- </p>
- <p>
- Not all R blocks are printed. Sweave options allow the printing of
- the evaluated code, the output of the code, both, or neither.
- </p>
- </div>
- <div id="outline-container-1.2.1" class="outline-4">
- <h4 id="sec-1.2.1">1.2.1 R code that is not printed </h4>
- <div id="text-1.2.1">
- <div id="R-1">
- <pre>
- > a <- 3
- > b <- 6
- </pre>
- </div>
- </div>
- </div>
- <div id="outline-container-1.2.2" class="outline-4">
- <h4 id="sec-1.2.2">1.2.2 R code that is printed </h4>
- <div id="text-1.2.2">
- <div id="R-2">
- <pre>
- > c <- 4
- </pre>
- </div>
- <p>
- We can use block labels to embed blocks by reference (even if they
- weren't printed before).
- </p></div>
- </div>
- <div id="outline-container-1.2.3" class="outline-4">
- <h4 id="sec-1.2.3">1.2.3 R code that references other blocks </h4>
- <div id="text-1.2.3">
- <div id="R-3">
- <pre>
- > #+R_CODEREF: hidden_block
- > #+R_CODEREF: visible_block
- > a + b +c
- </pre>
- </div>
- </div>
- </div>
- </div>
- <div id="outline-container-1.3" class="outline-3">
- <h3 id="sec-1.3">1.3 Inline references to R data </h3>
- <div id="text-1.3">
- <p>We can evaluate R code inline.
- </p>
- </div>
- <div id="outline-container-1.3.1" class="outline-4">
- <h4 id="sec-1.3.1">1.3.1 Used in text </h4>
- <div id="text-1.3.1">
- <p>The value of <code>a</code> is 3.
- </p>
- </div>
- </div>
- <div id="outline-container-1.3.2" class="outline-4">
- <h4 id="sec-1.3.2">1.3.2 Used in a table </h4>
- <div id="text-1.3.2">
- <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
- <col align="left"></col><col align="left"></col><col align="left"></col><col align="left"></col>
- <thead>
- <tr><th>a</th><th>b</th><th>c</th><th>TOTAL</th></tr>
- </thead>
- <tbody>
- <tr><td>3</td><td>6</td><td>4</td><td>13</td></tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <div id="outline-container-1.4" class="outline-3">
- <h3 id="sec-1.4">1.4 Single-line R commands </h3>
- <div id="text-1.4">
- <p>If we want a line of R code to be evaluated but not printed,
- there's a convenient shorthand. This only works for single lines
- of R code, but you can have more than one in a row.
- </p>
- </div>
- </div>
- <div id="outline-container-1.5" class="outline-3">
- <h3 id="sec-1.5">1.5 Graphics </h3>
- <div id="text-1.5">
- <p>We use values defined elsewhere in the buffer to produce this
- graph. The new CAPTION and LABEL arguments work just fine.
- </p>
- <div id="R-4">
- <pre>
- > print(xyplot(speed ~ dist, cars,
- > panel = function (x, y, ...) {
- > panel.xyplot(x, y, ...)
- > panel.abline(h=a)
- > panel.abline(v=b)
- > }))
- </pre>
- </div>
- <p>
- <a href="e.eps">file:e.eps</a>
- </p></div>
- </div>
- </div>
- <div id="postamble"><p class="author"> Author: Eric Schulte
- <a href="mailto:schulte.eric@gmail.com"><schulte.eric@gmail.com></a>
- </p>
- <p class="date"> Date: 2009-02-05 15:41:29 PST</p>
- <p>HTML generated by org-mode 6.20f in emacs 23</p>
- </div></body>
- </html>
|