1<!DOCTYPE html> 2<html> 3<head> 4 <title>Tools for Reproducible Research and Dynamic Documents with R</title> 5 <meta charset="utf-8"> 6 <meta name="description" content="Tools for Reproducible Research and Dynamic Documents with R"> 7 <meta name="author" content="Mathew W. McLean"> 8 <meta name="generator" content="slidify" /> 9 <meta name="apple-mobile-web-app-capable" content="yes"> 10 <meta http-equiv="X-UA-Compatible" content="chrome=1"> 11 <link rel="stylesheet" href="libraries/frameworks/io2012/css/default.css" media="all" > 12 <link rel="stylesheet" href="libraries/frameworks/io2012/css/phone.css" 13 media="only screen and (max-device-width: 480px)" > 14 <link rel="stylesheet" href="libraries/frameworks/io2012/css/slidify.css" > 15 <link rel="stylesheet" href="libraries/highlighters/highlight.js/css/tomorrow.css" /> 16 <base target="_blank"> <!-- This amazingness opens all links in a new tab. --> <link rel=stylesheet href="./assets/css/custom.css"></link> 17<link rel=stylesheet href="./assets/css/oldcustom.css"></link> 18<link rel=stylesheet href="./assets/css/ribbons.css"></link> 19 20 21 <!-- Grab CDN jQuery, fall back to local if offline --> 22
22<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js"></script>
22 23
23<script>window.jQuery || document.write('
23<script src="libraries/widgets/quiz/js/jquery.js"><\/script>')</script>
23 24
24<script data-main="libraries/frameworks/io2012/js/slides" 25 src="libraries/frameworks/io2012/js/require-1.0.8.min.js"> 26 </script>
26 27 28 29 30</head> 31<body style="opacity: 0"> 32 <slides class="layout-widescreen"> 33 34 <!-- LOGO SLIDE --> 35 <slide class="title-slide segue nobackground"> 36 <hgroup class="auto-fadein"> 37 <h1>Tools for Reproducible Research and Dynamic Documents with R</h1> 38 <h2>IAMCS Machine Learning and Applied Statistics Workshop Series</h2> 39 <h2>February 25, 2014</h2> 40 <div> 41 <p>Mathew W. McLean<br/>Research Assistant Professor<br/>Texas A & M University<br/>http://stat.tamu.edu/~mmclean</p> 42 <aside class = "titleImg" id = "UniLogo"> 43 <img src="assets/img/Tamulogo.png"> 44 </aside> 45 </div> 46 </hgroup> 47 <a id="fsshortcut" href="javascript:void(0)" class="tshortcut" target="_self"> 48 Full screen 49 </a> 50 <a id="printshortcut" href="javascript:void(0)" class="tshortcut" target="_self"> 51 Print 52 </a> 53 <a id="dlshortcut" href="https://github.com/mwmclean/iamcs2" class="tshortcut" target="_self"> 54 Source 55 </a> 56 57 <article><button class="navButton" id = "titleButton" onclick="window.slidedeck.nextSlide()">→</button></article> 58</slide> 59 60 61 <!-- SLIDES --> 62 <slide class="body-slide" id="slide-1" style="background:;"> 63 <hgroup> 64 <table class = "navTable"> 65 <tr> 66 <td class = "navLeft"> 67 <h2><h2>Why Should You Care?</h2></h2> 68 </td> 69 <td class = "navRight"> 70 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 71 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 72 </td> 73 </tr> 74 </table> 75 </hgroup> 76 <article data-timings=""> 77 <h3><strong>Your research should be reproducible!</strong></h3> 78 79<ul> 80<li>An <a href="http://www.amstat.org/sections/sbss/webinarfiles/berger-webinar10-2-2012.pdf">alarming number</a> of results published in top academic journals <a href="http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1182327/">cannot be reproduced</a></li> 81<li>Ideally, output of research is not just a paper, but all code and data needed to reproduce it</li> 82<li><em>Literate Programming</em>: 83 84<ul> 85<li>A program should have plain language explanations interpersed with source code</li> 86<li>Tools such as <code>Sweave</code> and <code>knitr</code>, make this simple to do</li> 87<li>Results are automatically included when document is created (no exporting needed)</li> 88<li>Changes are automatically incorporated if methods change</li> 89</ul></li> 90</ul> 91 92 </article> 93 <!-- Presenter Notes --> 94</slide> 95 96<slide class="body-slide" id="slide-2" style="background:;"> 97 <hgroup> 98 <table class = "navTable"> 99 <tr> 100 <td class = "navLeft"> 101 <h2><h2>Why Should You Care?</h2></h2> 102 </td> 103 <td class = "navRight"> 104 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 105 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 106 </td> 107 </tr> 108 </table> 109 </hgroup> 110 <article data-timings=""> 111 <h3><strong>It makes your life easier!</strong></h3> 112 113<ul> 114<li>Already know <code>LaTeX</code>? 115 116<ul> 117<li>The basics of <code>knitr</code> can be learned quite quickly 118 119<ul> 120<li>Just write <code>LaTeX</code> as usual with benefit of being able to add chunks of <code>R</code> code</li> 121<li>No wasted time saving <code>R</code> results and manually inputting them into a <code>TeX</code> file</li> 122</ul></li> 123</ul></li> 124<li>Do you really need all the bells and whistles of <code>LaTeX</code>? 125 126<ul> 127<li>If you're fine with your document just being viewed on the web, then you don't</li> 128<li>If you don't need to submit for publication to a journal, then you probably don't</li> 129<li>If you don't, you can use <code>Markdown</code>! 130 131<ul> 132<li>Has an extremely simple syntax which can be learned in minutes</li> 133<li>Can be converted to <code>HTML</code> or <code>PDF</code> formats nearly instantaneously</li> 134</ul></li> 135</ul></li> 136<li>For teaching, the interactivity we can gain by using <code>HTML</code> has considerable potential</li> 137</ul> 138 139 </article> 140 <!-- Presenter Notes --> 141</slide> 142
143<slide class="body-slide" id="slide-3" style="background:;"> 144 <hgroup> 145 <table class = "navTable"> 146 <tr> 147 <td class = "navLeft"> 148 <h2><h2>Why Should You Care?</h2></h2> 149 </td> 150 <td class = "navRight"> 151 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 152 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 153 </td> 154 </tr> 155 </table> 156 </hgroup> 157 <article data-timings=""> 158 <h3><strong>It makes your life easier!</strong></h3> 159 160<ul> 161<li><a href="http://www.rstudio.com/"><code>RStudio</code></a> development environment for <code>R</code></li> 162<li>Several features that make it easier to code in <code>R</code> including: 163 164<ul> 165<li>Easy intergration with <code>Markdown</code> and <code>LaTeX</code> for <a href="http://www.rstudio.com/ide/docs/presentations/overview">presentations</a> and <a href="https://www.rstudio.com/ide/docs/authoring/markdown_notebooks">reports</a></li> 166<li>Tools for organizing different <a href="http://www.rstudio.com/ide/docs/using/projects">projects</a></li> 167<li>Tools for <a href="http://www.rstudio.com/ide/docs/packages/overview">creating</a> and <a href="http://www.rstudio.com/ide/docs/packages/building">building</a> packages: integration with <code>devtools</code> and <code>roxygen2</code></li> 168<li><a href="http://www.rstudio.com/ide/docs/debugging/overview">Debugging tools</a></li> 169<li><a href="https://www.rstudio.com/ide/docs/version_control/overview">Support</a> for version control systems</li> 170<li>Lots of <a href="https://www.rstudio.com/ide/docs/using/customizing">options</a> for customizing appearance and other settings</li> 171</ul></li> 172</ul> 173 174 </article> 175 <!-- Presenter Notes --> 176</slide> 177 178<slide class="body-slide" id="slide-4" style="background:;"> 179 <hgroup> 180 <table class = "navTable"> 181 <tr> 182 <td class = "navLeft"> 183 <h2><h2>Why Should You Care?</h2></h2> 184 </td> 185 <td class = "navRight"> 186 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 187 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 188 </td> 189 </tr> 190 </table> 191 </hgroup> 192 <article data-timings=""> 193 <h3><strong>It makes your life easier!</strong></h3> 194 195<ul> 196<li>Using <code>GitHub</code> or another version control service for collaborations 197 198<ul> 199<li>No back and forth emailing of code (each developer gets their own copy)</li> 200<li>Easy to go back to an old version of code if something breaks</li> 201<li>Compare multiple versions of code at once</li> 202<li>Add visibility to your work, makes it easier for others to access and share it</li> 203<li>If you want, other users (total strangers!) can edit your code and suggest changes</li> 204<li>Putting code on it is easier than submitting to CRAN (code doesn't even have to work!)</li> 205<li>Keep track of progress and how much work is being done by whom</li> 206</ul></li> 207</ul> 208 209 </article> 210 <!-- Presenter Notes --> 211</slide> 212 213<slide class="" id="slide-5" style="background:;"> 214 <hgroup> 215 <table class = "navTable"> 216 <tr> 217 <td class = "navLeft"> 218 <h2><h2>Markup Languages</h2></h2> 219 </td> 220 <td class = "navRight"> 221 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 222 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 223 </td> 224 </tr> 225 </table> 226 </hgroup> 227 <article data-timings=""> 228 <ul> 229<li>A system for annotating a document to separate metadata from text</li> 230<li>E.g. <code>TeX</code>, <code>LaTeX</code>, <code>HTML</code> (HyperText Markup Language)</li> 231<li>Sometimes the markup is hidden from the author, e.g. <code>Microsoft Word</code> (WYSIWYG)</li> 232<li>Procedural markup: provides instructions for other programs to process, e.g. <code>TeX</code></li> 233<li>Descriptive/semantic markup: the markup provides descriptive labels, e.g. <code>HTML</code></li> 234<li><em>Lightweight markup language</em> - markup language with simple syntax 235 236<ul> 237<li>Easy to write and easy to read</li> 238<li><code>Markdown</code> is a widely used example</li> 239<li>Can be quickly converted to other markup languages such as <code>HTML</code></li> 240</ul></li> 241</ul> 242 243 </article> 244 <!-- Presenter Notes --> 245</slide> 246
247<slide class="" id="slide-6" style="background:;"> 248 <hgroup> 249 <table class = "navTable"> 250 <tr> 251 <td class = "navLeft"> 252 <h2><h2><a href="http://www.rstudio.com/ide/docs/authoring/using_markdown"><code>R Markdown</code></a></h2></h2> 253 </td> 254 <td class = "navRight"> 255 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 256 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 257 </td> 258 </tr> 259 </table> 260 </hgroup> 261 <article data-timings=""> 262 <ul> 263<li>Provides a simple syntax for creating reproducible documents</li> 264<li><code>R</code> code is executed and embedded, then report is converted to <code>Markdown</code> and <code>HTML</code> 265 266<ul> 267<li>Objects created in one chunk of code are available to later chunks</li> 268</ul></li> 269<li>In it's simplest/easiest use, any <code>R</code> script may be converted to <code>HTML</code> or <code>PDF</code></li> 270<li><a href="https://www.rstudio.com/ide/docs/authoring/markdown_notebooks"><code>RStudio Notebooks</code></a> 271 272<ul> 273<li>Runs <code>R</code> code in script, outputs results immediately after each line of code</li> 274<li>Open any <code>R</code> script in <code>RStudio</code> and press <code>Ctrl+Shift+Alt+H</code></li> 275</ul></li> 276<li>The <a href="http://yihui.name/knitr/demo/stitch/"><code>stitch</code> and <code>spin</code></a> functions in <code>knitr</code> provide additional formatting possibilties</li> 277<li>A quick reference document is available in <code>RStudio</code> and <a href="assets/html/MarkdownQuickReference.html">here</a></li> 278<li>Template is provided when <code>.Rmd</code> file started</li> 279<li>Mathematical notation is supported via <code>MathJax</code>; uses same markup to denote math as <code>TeX</code></li> 280<li>Appearance can be customized using <code>CSS</code></li> 281</ul> 282 283 </article> 284 <!-- Presenter Notes --> 285</slide> 286 287<slide class="img-slide" id="slide-7" style="background:;"> 288 <hgroup> 289 <table class = "navTable"> 290 <tr> 291 <td class = "navLeft"> 292 <h2><h2>Getting Started in <code>RStudio</code></h2></h2> 293 </td> 294 <td class = "navRight"> 295 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 296 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 297 </td> 298 </tr> 299 </table> 300 </hgroup> 301 <article data-timings=""> 302 <p><img src="assets/img/RStudioRmd2.svg" alt="rstudiopic"></p> 303 304 </article> 305 <!-- Presenter Notes --> 306</slide> 307 308<slide class="no-highlight" id="slide-8" style="background:;"> 309 <hgroup> 310 <table class = "navTable"> 311 <tr> 312 <td class = "navLeft"> 313 <h2><h2>Example</h2></h2> 314 </td> 315 <td class = "navRight"> 316 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 317 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 318 </td> 319 </tr> 320 </table> 321 </hgroup> 322 <article data-timings=""> 323 <pre><code class="r">Header 1 324====== 325### Header 2 326Here is some inline R code: `r 1+1` 327**This is bold** and *this is emphasized* and `this is monospace` and 328[this is a link](http://example.com) 329* Here 330* is 331 23. a 332 54. nested 333 1. list 334</code></pre> 335 336<p>And now a code block</p> 337 338<p>```{r} 339rnorm(3) 340```</p> 341 342 </article> 343 <!-- Presenter Notes --> 344</slide> 345 346<slide class="smallerSpacing" id="slide-9" style="background:;"> 347 <hgroup> 348 <table class = "navTable"> 349 <tr> 350 <td class = "navLeft"> 351 <h2><h2>Output</h2></h2> 352 </td> 353 <td class = "navRight"> 354 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 355 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 356 </td> 357 </tr> 358 </table> 359 </hgroup> 360 <article data-timings=""> 361 <h2>Header 1</h2> 362 363<h1>Header 2</h1> 364 365<p>Here is some inline R code: 2 366<strong>This is bold</strong> and <em>this is emphasized</em> and <code>this is monospace</code> 367and <a href="http://example.com">this is a link</a></p> 368 369<ul> 370<li>Here</li> 371<li>is 372 373<ol> 374<li>a</li> 375<li>nested</li> 376<li>list</li> 377</ol></li> 378</ul> 379 380<p>And now a code block</p> 381 382<pre><code class="r">rnorm(3) 383</code></pre> 384 385<pre><code>## [1] -1.7282 0.8667 -1.2091 386</code></pre> 387 388 </article> 389 <!-- Presenter Notes --> 390</slide> 391
392<slide class="" id="slide-10" style="background:;"> 393 <hgroup> 394 <table class = "navTable"> 395 <tr> 396 <td class = "navLeft"> 397 <h2><h2>From <code>Markdown</code> to <code>LaTeX</code></h2></h2> 398 </td> 399 <td class = "navRight"> 400 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 401 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 402 </td> 403 </tr> 404 </table> 405 </hgroup> 406 <article data-timings=""> 407 <ul> 408<li><code>Sweave</code> and <code>knitr</code> use a special <code>TeX</code> file with extension <code>.Rnw</code></li> 409<li>A <code>LaTeX</code> document that includes <code>R</code> code</li> 410<li>Code chunks are started with <code><< >>=</code> and ended with <code>@</code></li> 411<li>Inline code is written <code>\Sexpr{ }</code></li> 412<li>Helpful <a href="http://cran.r-project.org/web/packages/knitr/vignettes/knitr-refcard.pdf">quick reference</a></li> 413</ul> 414 415<pre><code class="r"><<chunkname, options>>= 416 library(ggplot2) 417 qplot(mpg, wt, data=mtcars) 418@ 419Here is some inline code \Sexpr{1+1} 420</code></pre> 421 422 </article> 423 <!-- Presenter Notes --> 424</slide> 425 426<slide class="" id="slide-11" style="background:;"> 427 <hgroup> 428 <table class = "navTable"> 429 <tr> 430 <td class = "navLeft"> 431 <h2><h2>Useful Chunk Options in <code>knitr</code></h2></h2> 432 </td> 433 <td class = "navRight"> 434 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 435 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 436 </td> 437 </tr> 438 </table> 439 </hgroup> 440 <article data-timings=""> 441 <ul> 442<li><a href="http://yihui.name/knitr/demo/cache/"><em>cache</em></a> - set to <code>TRUE</code> to store long calculations 443 444<ul> 445<li>even the slightest change to the chunk will cause it to be recalculated</li> 446<li>use <code>dependson='chunkname'</code> to specify which chunks the current chunk depends on</li> 447</ul></li> 448<li><em>echo</em> - <code>FALSE</code> to not output the code, <em>or</em> a numeric vector of which lines of code to hide</li> 449<li><em>eval</em> - <code>FALSE</code> to not evaluate the chunk, or numeric vector on lines to not evaluate 4508 <em>include</em> - <code>FALSE</code> to evaluate a chunk but not include the output</li> 451<li><em>tidy</em> - <code>FALSE</code> to turn off formatting of code (useful if text isn't wrapping properly)</li> 452<li><em>highlight</em> - <code>FALSE</code> to not colour code and output</li> 453<li>Lots of options for controlling plot output; see <a href="http://yihui.name/knitr/options">here</a></li> 454<li>For more customization you may need to set <a href="http://yihui.name/knitr/hooks">hooks</a></li> 455</ul> 456 457 </article> 458 <!-- Presenter Notes --> 459</slide> 460 461<slide class="" id="slide-12" style="background:;"> 462 <hgroup> 463 <table class = "navTable"> 464 <tr> 465 <td class = "navLeft"> 466 <h2><h2>Example: Automatic Generation of a Quiz</h2></h2> 467 </td> 468 <td class = "navRight"> 469 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 470 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 471 </td> 472 </tr> 473 </table> 474 </hgroup> 475 <article data-timings=""> 476 <ul> 477<li>Goal is to automatically generate a quiz from a test bank of questions</li> 478<li>Below are three questions written in syntax for <code>.Rnw</code> files and stored in an <code>R</code> vector 479 480<ul> 481<li><code>\Sexpr{...}</code> for inline <code>R</code> code <code><<>>= ... @</code> for chunks</li> 482</ul></li> 483</ul> 484 485<pre><code class="r">TestBank <- c("Construct a \\emph{\\Sexpr{c('box plot', 'stem-and-left plot', 486 'Normal Q-Q plot')[sample(3, 1)]}} for the following sample of data 487 (\\Sexpr{paste0(round(rnorm(10, mean = 60), 1), collapse = ', ')}).", 488"Construct a \\Sexpr{sample(c(90, 95, 99), 1)}\\% confidence interval for 489the ratio of the variances of the following two samples 490(\\Sexpr{paste0(rpois(10, 10), collapse = ', ')}) and 491(\\Sexpr{paste0(rpois(6, 6), collapse = ', ')}).", 492"What is the probability that an expontential random variable with $\\lambda = 1$ 493exceeds 1.5 given that it exceeds 1.") 494</code></pre> 495 496<ul> 497<li>We can randomly choose questions from the test bank</li> 498<li>Here notice the first two questions will have new data each time they are generated</li> 499</ul> 500 501 </article> 502 <!-- Presenter Notes --> 503</slide> 504
505<slide class="smallerSpacing" id="slide-13" style="background:;"> 506 <hgroup> 507 <table class = "navTable"> 508 <tr> 509 <td class = "navLeft"> 510 <h2><h2>Example: Automatic Generation of a Quiz</h2></h2> 511 </td> 512 <td class = "navRight"> 513 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 514 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 515 </td> 516 </tr> 517 </table> 518 </hgroup> 519 <article data-timings=""> 520 <ul> 521<li>We can then write a <code>brew</code> document to generate the questions and output an <code>.Rnw</code> file</li> 522<li>Assuming we saved the <code>TestBank</code> vector in <code>TestBank.R</code>...</li> 523<li>Chunks of <code>R</code> code are delimited using <code><%...>%</code> or <code><%= ... >%</code> (latter outputs the results)</li> 524</ul> 525 526<pre><code class="r">\documentclass[12pt]{article} 527\title{An Example Quiz using \texttt{brew} and \texttt{knitr} \\ \large IAMCS Seminar} 528\author{Mathew McLean} 529\usepackage{amsmath,graphicx} 530\begin{document} 531\maketitle 532<% source("TestBank.R") 533test.length <- 2 534questions <- TestBank[sample(length(TestBank), test.length)] %> 535<%= for (i in seq_along(questions)){ 536 cat(paste0("\\textbf{Question ", i, "}\n")) 537 cat(paste(questions[i], "\\vskip 5cm\n", sep = "\n")) 538} %> 539\end{document} 540</code></pre> 541 542 </article> 543 <!-- Presenter Notes --> 544</slide> 545 546<slide class="" id="slide-14" style="background:;"> 547 <hgroup> 548 <table class = "navTable"> 549 <tr> 550 <td class = "navLeft"> 551 <h2><h2>Example: Automatic Generation of a Quiz</h2></h2> 552 </td> 553 <td class = "navRight"> 554 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 555 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 556 </td> 557 </tr> 558 </table> 559 </hgroup> 560 <article data-timings=""> 561 <p>Assuming we have saved the document on the previous slide as "quiz.brew"...</p> 562 563<pre><code class="r">library(brew) 564library(knitr) 565brew("quiz.brew", "quiz.Rnw") 566knit2pdf("quiz.Rnw", "quiz.pdf") 567</code></pre> 568 569 </article> 570 <!-- Presenter Notes --> 571</slide> 572 573<slide class="" id="slide-15" style="background:;"> 574 <hgroup> 575 <table class = "navTable"> 576 <tr> 577 <td class = "navLeft"> 578 <h2><h2>Example: Automatic Generation of a Quiz</h2></h2> 579 </td> 580 <td class = "navRight"> 581 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 582 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 583 </td> 584 </tr> 585 </table> 586 </hgroup> 587 <article data-timings=""> 588 <iframe src="assets/quizEx/quiz.pdf" type='application/pdf'></iframe> 589 590 </article> 591 <!-- Presenter Notes --> 592</slide> 593 594<slide class="" id="slide-16" style="background:;"> 595 <hgroup> 596 <table class = "navTable"> 597 <tr> 598 <td class = "navLeft"> 599 <h2><h2>Example: Automatic Generation of a Quiz</h2></h2> 600 </td> 601 <td class = "navRight"> 602 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 603 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 604 </td> 605 </tr> 606 </table> 607 </hgroup> 608 <article data-timings=""> 609 <iframe src="assets/quizEx/quiz2.pdf" type='application/pdf'></iframe> 610 611 </article> 612 <!-- Presenter Notes --> 613</slide> 614 615<slide class="" id="slide-17" style="background:;"> 616 <hgroup> 617 <table class = "navTable"> 618 <tr> 619 <td class = "navLeft"> 620 <h2><h2>Creating <code>HTML5</code> Presentations In <code>R</code></h2></h2> 621 </td> 622 <td class = "navRight"> 623 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 624 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 625 </td> 626 </tr> 627 </table> 628 </hgroup> 629 <article data-timings=""> 630 <ul> 631<li><a href="http://slidify.org/"><code>Slidify</code></a> and <code>Rstudio</code> <a href="http://www.rstudio.com/ide/docs/presentations/overview"><code>R Presentations</code></a> convert <code>Rmd</code> files into <code>HTML5</code> slides 632 633<ul> 634<li>Rstudio's version is easier to use</li> 635<li>Slidify allows for more customization, can use several different frameworks</li> 636</ul></li> 637<li>Slightly different syntax for both 638 639<ul> 640<li>For <code>Slidify</code>, slides are separated using "---"</li> 641<li>For <code>Rstudio R Presentations</code>, new slide begins with header using "====="</li> 642</ul></li> 643<li>Allows users to interact with your slides 644 645<ul> 646<li>All the powers of JavaScript are at your fingertips</li> 647</ul></li> 648<li>Compilation is much faster than <code>LaTeX/Beamer</code></li> 649<li>Easier to type and less commands to remember</li> 650<li>With a little CSS and HTML knowledge becomes very easy to customize and debug 651 652<ul> 653<li>Customizing <a href="https://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering">RStudio output</a> and customizing <a href="http://slidify.org/customize.html">Slidify</a></li> 654</ul></li> 655</ul> 656 657 </article> 658 <!-- Presenter Notes --> 659</slide> 660
661<slide class="" id="slide-18" style="background:;"> 662 <hgroup> 663 <table class = "navTable"> 664 <tr> 665 <td class = "navLeft"> 666 <h2><h2>Example: Interactive Graphics from <a href="http://www.highcharts.com/">Highcharts</a></h2></h2> 667 </td> 668 <td class = "navRight"> 669 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 670 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 671 </td> 672 </tr> 673 </table> 674 </hgroup> 675 <article data-timings=""> 676 <p>Average daily temperature for several Canadian cities (click and hover on curves and names)</p> 677 678<p>See <a href="http://ramnathv.github.io/rCharts/">rCharts</a>, <a href="https://code.google.com/p/google-motion-charts-with-r/">googleVis</a>, and <a href="https://github.com/rstudio/ggvis">ggvis</a> packages in <code>R</code></p> 679 680<iframe src="assets/html/lineEx3.html"></iframe> 681 682 </article> 683 <!-- Presenter Notes --> 684</slide> 685 686<slide class="" id="slide-19" style="background:;"> 687 <hgroup> 688 <table class = "navTable"> 689 <tr> 690 <td class = "navLeft"> 691 <h2><h2>More Canadian Weather Data - <code>googleVis</code></h2></h2> 692 </td> 693 <td class = "navRight"> 694 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 695 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 696 </td> 697 </tr> 698 </table> 699 </hgroup> 700 <article data-timings=""> 701 <p>Average daily temperature (℃) and total yearly rainfall (mm.)</p> 702 703<table style="width: 100%; background-color: white; table-layout: fixed;"> 704<tr> 705<td style="width: 75%; height: 145px; background-color: white"> 706 707``` 708## Warning: there is no package called 'googleVis' 709``` 710 711``` 712## Error: could not find function "gvisGeoChart" 713``` 714 715``` 716## Error: error in evaluating the argument 'x' in selecting a method for function 'print': Error: object 'myGp' not found 717``` 718</td> 719<td style="width: 25%; background-color: white; height: 145px;"> 720<svg xmlns="http://www.w3.org/2000/svg" 721xmlns:xlink="http://www.w3.org/1999/xlink"> 722 <circle cx="5" cy="10" r="5" fill="green" /> 723 <circle cx="20" cy="10" r="7" fill="green" /> 724 <circle cx="40" cy="10" r="10" fill="green" /> 725 <text x="60" y="15" font-size="12" font-weight="bold"> - Yearly rainfall</text> 726 <circle cx="10" cy="40" r="7" fill="lightgrey" /> 727 <circle cx="26" cy="40" r="7" fill="#8FBC8F" /> 728 <circle cx="43" cy="40" r="7" fill="green" /> 729 <text x="60" y="45" font-size="12" font-weight="bold"> - Average daily temperature</text> 730</svg> 731</td> 732</tr> 733</table> 734 735<pre><code class="r">library(googleVis) 736## ... omitted formatting of cw.dat data.frame 737gvisGeoChart(cw.dat, locationvar="lat.long", colorvar='ave.temp', hovervar='place', 738 sizevar='total.precip', options=list(region='CA', resolution='provinces')) 739</code></pre> 740 741 </article> 742 <!-- Presenter Notes --> 743</slide> 744 745<slide class="" id="slide-20" style="background:;"> 746 <hgroup> 747 <table class = "navTable"> 748 <tr> 749 <td class = "navLeft"> 750 <h2><h2>3D plots with <a href="http://cran.r-project.org/web/packages/rgl/index.html"><code>RGL</code></a> and <code>WebGL</code></h2></h2> 751 </td> 752 <td class = "navRight"> 753 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 754 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 755 </td> 756 </tr> 757 </table> 758 </hgroup> 759 <article data-timings=""> 760 <iframe src="assets/html/FGAMrgl.html" id="rgl"></iframe> 761 762 </article> 763 <!-- Presenter Notes --> 764</slide> 765 766<slide class="" id="slide-21" style="background:;"> 767 <hgroup> 768 <table class = "navTable"> 769 <tr> 770 <td class = "navLeft"> 771 <h2><h2><code>Shiny</code></h2></h2> 772 </td> 773 <td class = "navRight"> 774 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 775 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 776 </td> 777 </tr> 778 </table> 779 </hgroup> 780 <article data-timings=""> 781 <ul> 782<li><a href="http://www.rstudio.com/shiny/"><code>Shiny</code></a>, can be used to write applications for the web in <code>R</code></li> 783<li>As interacts with the app (changes inputs), <code>R</code> code is rerun to update the outputs (<em>reactivity</em>)</li> 784<li>As with the tools presented earlier, no knowledge of <code>HTML</code> or <code>Javascript</code> is needed</li> 785<li>Apps can be deployed locally using the <code>shiny</code> package or hosted on the web</li> 786<li>A great <a href="http://rstudio.github.io/shiny/tutorial/">
786tutorial</a> and lots of <a href="http://www.rstudio.com/shiny/showcase/">examples</a> are available on the <code>RStudio</code> website</li> 787</ul> 788 789 </article> 790 <!-- Presenter Notes --> 791</slide> 792 793<slide class="smallerSpacing" id="slide-22" style="background:;"> 794 <hgroup> 795 <table class = "navTable"> 796 <tr> 797 <td class = "navLeft"> 798 <h2><h2>Example: Functional Regression Modelling</h2></h2> 799 </td> 800 <td class = "navRight"> 801 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 802 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 803 </td> 804 </tr> 805 </table> 806 </hgroup> 807 <article data-timings=""> 808 <p>(May need a moment to load)</p> 809 810<iframe data-src="https://fgam.shinyapps.io/fgam/" style="width: 900px; height: 600px seamless" id="shinyframe"></iframe> 811 812 </article> 813 <!-- Presenter Notes --> 814</slide> 815 816<slide class="" id="slide-23" style="background:;"> 817 <hgroup> 818 <table class = "navTable"> 819 <tr> 820 <td class = "navLeft"> 821 <h2><h2>Version Control Systems (VCS)</h2></h2> 822 </td> 823 <td class = "navRight"> 824 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 825 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 826 </td> 827 </tr> 828 </table> 829 </hgroup> 830 <article data-timings=""> 831 <ul> 832<li>For managing changes to documents and code</li> 833<li><p>In a <em>distributed VCS</em></p> 834 835<ul> 836<li>There is no central repository</li> 837<li>Each developer has their own copy of all code</li> 838<li>No need to be connected to a server, other than to share with other developers</li> 839</ul></li> 840<li><p>The two most popular systems are <code>Git</code> and <code>Subversion</code> (<code>SVN</code>)</p> 841 842<ul> 843<li><code>Git</code> is a <em>distributed</em> VCS, <code>SVN</code> is not</li> 844<li><code>R</code> project uses <a href="http://svn.r-project.org/R/branches/">SVN</a></li> 845</ul></li> 846<li><p>With Git, nearly all operations are done locally and very quickly</p> 847 848<ul> 849<li>Delta compression is used: only differences between versions are stored</li> 850</ul></li> 851</ul> 852 853 </article> 854 <!-- Presenter Notes --> 855</slide> 856 857<slide class="" id="slide-24" style="background:;"> 858 <hgroup> 859 <table class = "navTable"> 860 <tr> 861 <td class = "navLeft"> 862 <h2><h2>Why Use Git/GitHub (Even to Work Alone)?</h2></h2> 863 </td> 864 <td class = "navRight"> 865 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 866 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 867 </td> 868 </tr> 869 </table> 870 </hgroup> 871 <article data-timings=""> 872 <ul> 873<li>Backup of all files</li> 874<li>Track history of all changes to every file</li> 875<li>Public or private depending on preference</li> 876<li>Easy to transfer files between workstations (e.g. home/laptop and office PC)</li> 877<li>Take frequent "snapshots" (<a href="http://gitref.org/basic/"><em>commits</em></a>) of code, making it easier to find where issues started</li> 878<li>Have a <a href="http://git-scm.com/book/ch3-1.html"><em>branch</em></a> for working code only, one for fixing bugs, another for adding new features 879 880<ul> 881<li><em>branching</em> and <em>merging</em> is so fast/easy that it can and should be done frequently</li> 882</ul></li> 883<li>No emailing of code to anyone, they simply checkout a copy of the repository 884 885<ul> 886<li><a href="https://help.github.com/articles/how-do-i-add-a-collaborator">Can give permission to make</a> (<em>push</em>) changes to a repo, or allow only a <em>fork</em></li> 887</ul></li> 888<li>Users can easily report issues and suggest changes (a <a href="https://help.github.com/articles/using-pull-requests"><em>pull request</em></a>) on GitHub</li> 889</ul> 890 891 </article> 892 <!-- Presenter Notes --> 893</slide> 894 895<slide class="" id="slide-25" style="background:;"> 896 <hgroup> 897 <table class = "navTable"> 898 <tr> 899 <td class = "navLeft"> 900 <h2><h2><code>GitHub</code></h2></h2> 901 </td> 902 <td class = "navRight"> 903 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 904 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 905 </td> 906 </tr> 907 </table> 908 </hgroup> 909 <article data-timings=""> 910 <ul> 911<li>I personally began using the <code>GitHub</code> GUI before knowing any <code>Git</code>, finding it very easy to use 912 913<ul> 914<li>Learn more as projects grow in size and add collaborators</li> 915</ul></li> 916<li>Free public repositories 917 918<ul> 919<li>Private starts at $7/month for five repositories</li> 920</ul></li> 921<li><a href="http://windows.github.com">GUI for Windows</a> provides simple interface for many commands</li> 922<li>Checkout <code>R</code> packages hosted on <code>GitHub</code> using <code>devtools</code>'s <code>install_github</code> function</li> 923<li>Can use <a href="http://travis-ci.com/">Travis CI</a> to automatically test your software 924 925<ul> 926<li>With each push to repo, <code>Travis CI</code> will build your project and run tests</li> 927</ul></li> 928</ul> 929 930 </article> 931 <!-- Presenter Notes --> 932</slide> 933
934<slide class="smallerSpacing" id="slide-26" style="background:;"> 935 <hgroup> 936 <table class = "navTable"> 937 <tr> 938 <td class = "navLeft"> 939 <h2><h2>A Sampling of Git Commands and Terminology</h2></h2> 940 </td> 941 <td class = "navRight"> 942 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 943 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 944 </td> 945 </tr> 946 </table> 947 </hgroup> 948 <article data-timings=""> 949 <ul> 950<li><em>init</em> - initializes a new repository</li> 951<li><em>clone</em> - create a copy of a repository</li> 952<li><em>branch</em> - an isolated working copy of the project</li> 953<li><em>commit</em> - the state of the project at a particular time (used to record changes)</li> 954<li><em>HEAD</em> - symbolic name of the currently checked out commit</li> 955<li><em>status</em> - gives information about the current working branch</li> 956<li><em>log</em> - show the commit logs</li> 957<li><em>remote</em> - manage the repositories you track (the "remotes")</li> 958<li><em>push</em> - push your changes to another repo (a complete copy must be pushed)</li> 959<li><em>fetch</em> - get files from another repository</li> 960<li><em>pull</em> - <em>fetch</em> from another repo and <em>merge</em> it with your branch 961<br/> 962The GUI can take care of the common tasks, but you will need to use a shell for some actions</li> 963</ul> 964 965 </article> 966 <!-- Presenter Notes --> 967</slide> 968 969<slide class="" id="slide-27" style="background:;"> 970 <hgroup> 971 <table class = "navTable"> 972 <tr> 973 <td class = "navLeft"> 974 <h2><h2>Managing Citations with <code>RefManageR</code></h2></h2> 975 </td> 976 <td class = "navRight"> 977 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 978 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 979 </td> 980 </tr> 981 </table> 982 </hgroup> 983 <article data-timings=""> 984 <ul> 985<li>Makes it easy to print, search, update, import, combine references in <code>R</code></li> 986<li>Can read in <code>.bib</code> files and read <code>PDF</code>s using <code>Poppler</code> to create a citation</li> 987<li>Citations can also be searched for on <code>Crossref</code>, <code>Google Scholar</code>, <code>Pubmed</code>, and <code>Zotero</code></li> 988<li>Searching is very flexible, can search by arbitrary field plus key or entry type</li> 989<li>Citations can be generated for inclusion in <code>RMarkdown</code> and <code>RHTML</code> documents</li> 990<li>Bibliography of all cited references can be printed at end of document 991 992<ul> 993<li>hyperlinks automatically added, many bibliography and citation style available</li> 994</ul></li> 995<li>Supports <code>BibLaTeX</code> and <code>Bibtex</code>
995 and converting <code>BibLaTeX</code> to <code>BibTeX</code> if forced</li> 996<li>Simple interface for setting default behaviour for the most used functions</li> 997</ul> 998 999 </article> 1000 <!-- Presenter Notes --> 1001</slide> 1002 1003<slide class="" id="slide-28" style="background:;"> 1004 <hgroup> 1005 <table class = "navTable"> 1006 <tr> 1007 <td class = "navLeft"> 1008 <h2><h2>Printing example</h2></h2> 1009 </td> 1010 <td class = "navRight"> 1011 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1012 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1013 </td> 1014 </tr> 1015 </table> 1016 </hgroup> 1017 <article data-timings=""> 1018 <pre><code class="r">library(RefManageR) 1019bib <- ReadBib(system.file("Bib", "biblatexExamples.bib", package = "RefManageR"), check = FALSE) 1020bib[[49:51]] 1021</code></pre> 1022 1023<pre><code>## [1] B. Malinowski. _Argonauts of the Western Pacific. An account of native enterprise and 1024## adventure in the Archipelagoes of Melanesian New Guinea_. 8th ed. London: Routledge and Kegan 1025## Paul, 1972. 1026## 1027## [2] M. Maron. _Animal Triste_. Trans. from the German by B. Goldstein. Lincoln: University of 1028## Nebraska Press, 2000. 1029## 1030## [3] W. Massa. _Crystal structure determination_. 2nd ed. Berlin: Spinger, 2004. 1031</code></pre> 1032 1033 </article> 1034 <!-- Presenter Notes --> 1035</slide> 1036 1037<slide class="" id="slide-29" style="background:;"> 1038 <hgroup> 1039 <table class = "navTable"> 1040 <tr> 1041 <td class = "navLeft"> 1042 <h2><h2>494 works of R.J. Carroll from Google Scholar</h2></h2> 1043 </td> 1044 <td class = "navRight"> 1045 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1046 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1047 </td> 1048 </tr> 1049 </table> 1050 </hgroup> 1051 <article data-timings=""> 1052 <pre><code class="r">bib2 <- ReadBib(system.file("Bib", "RJC.bib", package = "RefManageR")) 1053print(bib2[2:3], .opts = list(style = "text", bib.style = "alphabetic", sorting = "none")) 1054</code></pre> 1055 1056<pre><code>## [Jen+13] E. M. Jennings, J. S. Morris, R. J. Carroll, et al. "Bayesian methods for 1057## expression-based integration of various types of genomics data". In: _EURASIP Journal on 1058## Bioinformatics and Systems Biology_ 2013.1 (2013), pp. 1-11. 1059## 1060## [Gar+13] T. P. Garcia, S. Müller, R. J. Carroll, et al. "Identification of important 1061## regressor groups, subgroups and individuals via regularization methods: application to 1062## gut microbiome data". In: _Bioinformatics, btt_ 608 (2013). 1063</code></pre> 1064 1065<ul> 1066<li>Authors and other "name list" fields are stored in the <code>person</code> class</li> 1067</ul> 1068 1069<pre><code class="r">bib2[1]$author 1070</code></pre> 1071 1072<pre><code>## [1] "N Serban" "A M Staicu" "R J Carroll" 1073</code></pre> 1074 1075 </article> 1076 <!-- Presenter Notes --> 1077</slide> 1078 1079<slide class="" id="slide-30" style="background:;"> 1080 <hgroup> 1081 <table class = "navTable"> 1082 <tr> 1083 <td class = "navLeft"> 1084 <h2><h2>Extract and Update fields</h2></h2> 1085 </td> 1086 <td class = "navRight"> 1087 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1088 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1089 </td> 1090 </tr> 1091 </table> 1092 </hgroup> 1093 <article data-timings=""> 1094 <ul> 1095<li>Authors and other "name list" fields are stored in the <code>person</code> class</li> 1096<li>Let's add url and urldate fields for Jennings et al and fix the journal for Garcia et al.</li> 1097</ul> 1098 1099<pre><code class="r">bib2[2:3] <- list(c(url="http://bsb.eurasipjournals.com/content/2013/1/13", 1100 urldate = "2014-02-02"), c(doi="10.1093/bioinformatics/btt608", 1101 journal = "Bioinformatics")) 1102print(bib2[2:3], .opts = list(style = "html", bib.style = "authoryear")) 1103</code></pre> 1104 1105<p><cite>Garcia, T. P, S. Müller, R. J. Carroll, et al. 1106(2013). 1107“Identification of important regressor groups, subgroups and individuals via regularization methods: application to gut microbiome data”. 1108In: <em>Bioinformatics</em> 608. 1109DOI: <a href="http://dx.doi.org/10.1093/bioinformatics/btt608">10.1093/bioinformatics/btt608</a>.</cite></p> 1110 1111<p><cite>Jennings, E. M, J. S. Morris, R. J. Carroll, et al. 1112(2013). 1113“Bayesian methods for expression-based integration of various types of genomics data”. 1114In: <em>EURASIP Journal on Bioinformatics and Systems Biology</em>
1114 2013.1, pp. 1–11. 1115URL: <a href="http://bsb.eurasipjournals.com/content/2013/1/13">http://bsb.eurasipjournals.com/content/2013/1/13</a> (visited on Feb. 02, 2014).</cite></p> 1116 1117 </article> 1118 <!-- Presenter Notes --> 1119</slide> 1120 1121<slide class="" id="slide-31" style="background:;"> 1122 <hgroup> 1123 <table class = "navTable"> 1124 <tr> 1125 <td class = "navLeft"> 1126 <h2><h2>Searching with <code>SearchBib</code> and <code>[</code> Operator</h2></h2> 1127 </td> 1128 <td class = "navRight"> 1129 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1130 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1131 </td> 1132 </tr> 1133 </table> 1134 </hgroup> 1135 <article data-timings=""> 1136 <ul> 1137<li>How often is someone with family name "Wang" a coauthor?</li> 1138</ul> 1139 1140<pre><code class="r">length(bib2[author = "wang"]) 1141</code></pre> 1142 1143<pre><code>## [1] 37 1144</code></pre> 1145 1146<ul> 1147<li>How often is N. Wang a coauthor?</li> 1148</ul> 1149 1150<pre><code class="r">length(SearchBib(bib2, author = "Wang, N.", 1151 .opts = list(match.author = "family.with.initials"))) 1152</code></pre> 1153 1154<pre><code>## [1] 19 1155</code></pre> 1156 1157<ul> 1158<li>Use <code>names</code> to extract keys <code>bib$bibtype</code> to get entry types</li> 1159</ul> 1160 1161 </article> 1162 <!-- Presenter Notes --> 1163</slide> 1164 1165<slide class="codeChange" id="slide-32" style="background:;"> 1166 <hgroup> 1167 <table class = "navTable"> 1168 <tr> 1169 <td class = "navLeft"> 1170 <h2><h2>Searching with <code>SearchBib</code> and <code>[</code> Operator</h2></h2> 1171 </td> 1172 <td class = "navRight"> 1173 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1174 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1175 </td> 1176 </tr> 1177 </table> 1178 </hgroup> 1179 <article data-timings=""> 1180 <ul> 1181<li>How often did RJC and Ruppert collaborate after leaving UNC in July, 1987?</li> 1182</ul> 1183 1184<pre><code class="r">length(SearchBib(bib2, author='ruppert', date="1987-07/", 1185 .opts = list(match.date = "exact"))) 1186</code></pre> 1187 1188<pre><code>## [1] 53 1189</code></pre> 1190 1191<ul> 1192<li>Carroll and Ruppert papers NOT in the 1990's</li> 1193</ul> 1194 1195<pre><code class="r">length(SearchBib(bib2, author='ruppert', date = "!1990/1999")) 1196</code></pre> 1197 1198<pre><code>## [1] 59 1199</code></pre> 1200 1201<ul> 1202<li>Can specify keys using e.g. <code>bib2[c(key1, key2)]</code> or <code>bib2[key1,key2]</code></li> 1203</ul> 1204 1205 </article> 1206 <!-- Presenter Notes --> 1207</slide> 1208 1209<slide class="smallerSpacing" id="slide-33" style="background:;"> 1210 <hgroup> 1211 <table class = "navTable"> 1212 <tr> 1213 <td class = "navLeft"> 1214 <h2><h2>Searching and Setting Options</h2></h2> 1215 </td> 1216 <td class = "navRight"> 1217 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1218 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1219 </td> 1220 </tr> 1221 </table> 1222 </hgroup> 1223 <article data-timings=""> 1224 <ul> 1225<li>Carroll and Ruppert tech reports at UNC "OR" Carroll and Ruppert JASA papers</li> 1226</ul> 1227 1228<pre><code class="r">length(bib2[list(author='ruppert', bibtype="report", institution="north carolina"), 1229 list(author="ruppert",journal="journal of the american statistical association")]) 1230</code></pre> 1231 1232<pre><code>## [1] 22 1233</code></pre> 1234 1235<ul> 1236<li>Interface for options similar to <code>options</code> function</li> 1237</ul> 1238 1239<pre><code class="r">old.opts <- BibOptions(bib.style = "authoryear", match.author = "exact", ignore.case = FALSE, 1240 first.inits = FALSE, style = "html") 1241bib[author = "Baez, John C."] 1242</code></pre> 1243 1244<p><cite>Baez, John C. and Aaron D. Lauda 1245(2004a). 1246“Higher-Dimensional Algebra V: 2-Groups”. 1247Version 3. 1248In: <em>Theory and Applications of Categories</em> 12, pp. 423-491. 1249arXiv: <a href="http://arxiv.org/abs/math/0307200v3">math/0307200v3</a>.</cite></p> 1250 1251<p><cite>— 1252(2004b). 1253<em>Higher-Dimensional Algebra V: 2-Groups</em>. 1254arXiv: <a href="http://arxiv.org/abs/math/0307200v3">math/0307200v3</a>.</cite></p> 1255 1256<pre><code class="r">BibOptions(old.opts) # restore defaults 1257</code></pre> 1258 1259 </article> 1260 <!-- Presenter Notes --> 1261</slide> 1262
1263<slide class="" id="slide-34" style="background:;"> 1264 <hgroup> 1265 <table class = "navTable"> 1266 <tr> 1267 <td class = "navLeft"> 1268 <h2><h2>Citations for <code>RMarkdown</code> and <code>RHTML</code> Docs</h2></h2> 1269 </td> 1270 <td class = "navRight"> 1271 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1272 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1273 </td> 1274 </tr> 1275 </table> 1276 </hgroup> 1277 <article data-timings=""> 1278 <ul> 1279<li>Cite functions for citations, convenience functions <code>Citet</code>, <code>AutoCite</code>, <code>TextCite</code>, <code>Citep</code> 1280 1281<ul> 1282<li>Specify <code>style</code> as <code>"html"</code> or <code>"markdown"</code> for <code>HTML</code> and <code>Markdown</code> documents</li> 1283<li>Hyperlinks will be included automatically, and may be turned off if desired</li> 1284<li>The code in unevaluated, chunk form is as follows</li> 1285</ul></li> 1286</ul> 1287 1288<pre><code class="r">BibOptions(check.entries = FALSE, style = "html") 1289Citep(bib, author = "Itzhaki", .opts = list(cite.style = "alphabetic")) 1290TextCite(bib, c("loh", "wilde"), .opts = list(cite.style = "authoryear", hyperlink = "#35")) 1291</code></pre> 1292 1293<ul> 1294<li>Inline (wrapped in <code>I()</code>): Here is one citation [<a href='http://arxiv.org/abs/hep-th/9603067'>Itz96</a>], two more are <a href='#36'>Loh (1992)</a>; <a href='#36'>Wilde (1899)</a></li> 1295<li><code>Itz96</code> goes to the <code>arXiv</code> doc, the other two references go to the bibliography slide</li> 1296</ul> 1297 1298 </article> 1299 <!-- Presenter Notes --> 1300</slide> 1301 1302<slide class="" id="bibSlide" style="background:;"> 1303 <hgroup> 1304 <table class = "navTable"> 1305 <tr> 1306 <td class = "navLeft"> 1307 <h2><h2>Printing the bibliography</h2></h2> 1308 </td> 1309 <td class = "navRight"> 1310 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1311 <button class="navButton" onclick="window.slidedeck.nextSlide()">→</button> 1312 </td> 1313 </tr> 1314 </table> 1315 </hgroup> 1316 <article data-timings=""> 1317 <p>Now we print the bibliography, using <code>results='asis'</code> in the <code>knitr</code> chunk</p> 1318 1319<pre><code class="r">PrintBibliography(bib, .opts = list(bib.style = "numeric")) 1320</code></pre> 1321 1322<p><a id='bib-itzhaki'></a><a href="#cite-itzhaki">[1]</a><cite> 1323N. Itzhaki. 1324<em>Some remarks on 't Hooft's S-matrix for black holes</em>. 1325Mar. 11, 1996. 1326arXiv: <a href="http://arxiv.org/abs/hep-th/9603067">hep-th/9603067</a>.</cite></p> 1327 1328<p><a id='bib-loh'></a><a href="#cite-loh">[2]</a><cite> 1329N. C. Loh. 1330“High-Resolution Micromachined Interferometric Accelerometer”. 1331MA Thesis. 1332Cambridge, Mass.: Massachusetts Institute of Technology, 1992.</cite></p> 1333 1334<p><a id='bib-wilde'></a><a href="#cite-wilde">[3]</a><cite> 1335O. Wilde. 1336<em>The Importance of Being Earnest: A Trivial Comedy for Serious 1337People</em>. 1338English and American drama of the Nineteenth Century. 1339Leonard Smithers and Company, 1899. 1340Google Books: googlebooks.</cite></p> 1341 1342<ul> 1343<li>On a single webpage, the hyperlinks in e.g. <code>[1]</code>, will go to the point of first citation 1344 1345<ul> 1346<li>Getting this working automatically for <code>HTML5</code> slides is not implemented yet</li> 1347</ul></li> 1348</ul> 1349 1350 </article> 1351 <!-- Presenter Notes --> 1352</slide> 1353 1354<slide class="" id="slide-36" style="background:;"> 1355 <hgroup> 1356 <table style="width: 100%; background-color: white"> 1357 <tr> 1358 <td style="width: 90%; background-color: white"> 1359 <h2><h2>Learning More</h2></h2> 1360 </td> 1361 <td style="width: 10%; background-color: white"> 1362 <button class="navButton" onclick="window.slidedeck.prevSlide()">←</button> 1363 </td> 1364 </tr> 1365 </table> 1366 </hgroup> 1367 <article data-timings=""> 1368 <ul> 1369<li>See the <a href="http://cran.r-project.org/web/views/ReproducibleResearch.html">CRAN task view</a> on reproducible research for other <code>R</code> packages on this topic</li> 1370<li><a href="http://www.r-bloggers.com/brief-introduction-on-sweave-and-knitr-for-reproducible-research/?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+RBloggers+%28R+bloggers%29">These slides</a> for more on the basics of of <code>Sweave</code> and <code>knitr</code> and also Yihui Xie's <a href="http://yihui.name/knitr/">website</a></li> 1371<li>CRC Press has a <a href="http://www.crcpress.com/browse/series/crctherser">several titles</a> in the works and already available on the subject 1372 1373<ul> 1374<li><a href="http://www.crcpress.com/product/isbn/9781482203530">Dynamic Documents with R and knitr</a> and <a href="http://www.crcpress.com/product/isbn/9781466572843">Reproducible Research in R and RStudio</a></li> 1375</ul></li> 1376<li>For <code>RStudio</code>, see all the links for various features back on <a href="http://www.stat.tamu.edu/%7Emmclean/iamcs2/#4">Slide 4</a></li> 1377<li>
1377Ramnath Vaidyanathan's <a href="http://www.youtube.com/user/ramnathv1/videos?flow=grid&view=0">Youtube channel</a> for some neat demos of his packages 1378 1379<ul> 1380<li><code>Slidify</code>, <code>rNotebook</code>, <code>rCharts</code>, <code>rMaps</code>, etc. (all on <a href="https://github.com/ramnathv">Github</a>)</li> 1381</ul></li> 1382<li>The <a href="http://rstudio.github.io/shiny/tutorial/">Shiny tutorial</a> so nice, I'm linking to it twice</li> 1383<li>For <code>Git</code> see <a href="http://git-scm.com/docs">here</a>, <a href="https://www.atlassian.com/git/">here</a>, <a href="http://gitref.org">here</a>, and Pro Git <a href="https://github.s3.amazonaws.com/media/progit.en.pdf">(pdf here)</a></li> 1384<li><a href="http://johnmacfarlane.net/pandoc/"><code>Pandoc</code></a> - the "Swiss Army knife" for converting between markup languages</li> 1385<li>The <code>RefManager</code> package is <a href="http://cran.r-project.org/web/packages/RefManageR/index.html">available on CRAN</a></li> 1386</ul> 1387 1388 </article> 1389 <!-- Presenter Notes --> 1390</slide> 1391 <slide class="backdrop"></slide> 1392 </slides> 1393 <div class="pagination pagination-small" id='io2012-ptoc' style="display:none;"> 1394 <ul> 1395 <li> 1396 <a href="#" target="_self" rel='tooltip' 1397 data-slide=1 title='Why Should You Care?'> 1398 1 1399 </a> 1400 </li> 1401 <li> 1402 <a href="#" target="_self" rel='tooltip' 1403 data-slide=2 title='Why Should You Care?'> 1404 2 1405 </a> 1406 </li> 1407 <li> 1408 <a href="#" target="_self" rel='tooltip' 1409 data-slide=3 title='Why Should You Care?'> 1410 3 1411 </a> 1412 </li> 1413 <li> 1414 <a href="#" target="_self" rel='tooltip' 1415 data-slide=4 title='Why Should You Care?'> 1416 4 1417 </a> 1418 </li> 1419 <li> 1420 <a href="#" target="_self" rel='tooltip' 1421 data-slide=5 title='Markup Languages'> 1422 5 1423 </a> 1424 </li> 1425 <li> 1426 <a href="#" target="_self" rel='tooltip' 1427 data-slide=6 title='<a href="http://www.rstudio.com/ide/docs/authoring/using_markdown"><code>R Markdown</code></a>'> 1428 6 1429 </a> 1430 </li> 1431 <li> 1432 <a href="#" target="_self" rel='tooltip' 1433 data-slide=7 title='Getting Started in <code>RStudio</code>'> 1434 7 1435 </a> 1436 </li> 1437 <li> 1438 <a href="#" target="_self" rel='tooltip' 1439 data-slide=8 title='Example'> 1440 8 1441 </a> 1442 </li> 1443 <li> 1444 <a href="#" target="_self" rel='tooltip' 1445 data-slide=9 title='Output'> 1446 9 1447 </a> 1448 </li> 1449 <li> 1450 <a href="#" target="_self" rel='tooltip' 1451 data-slide=10 title='From <code>Markdown</code> to <code>LaTeX</code>'> 1452 10 1453 </a> 1454 </li> 1455 <li> 1456 <a href="#" target="_self" rel='tooltip' 1457 data-slide=11 title='Useful Chunk Options in <code>knitr</code>'> 1458 11 1459 </a> 1460 </li> 1461 <li> 1462 <a href="#" target="_self" rel='tooltip' 1463 data-slide=12 title='Example: Automatic Generation of a Quiz'> 1464 12 1465 </a> 1466 </li> 1467 <li> 1468 <a href="#" target="_self" rel='tooltip' 1469 data-slide=13 title='Example: Automatic Generation of a Quiz'> 1470 13 1471 </a> 1472 </li> 1473 <li> 1474 <a href="#" target="_self" rel='tooltip' 1475 data-slide=14 title='Example: Automatic Generation of a Quiz'> 1476 14 1477 </a> 1478 </li> 1479 <li> 1480 <a href="#" target="_self" rel='tooltip' 1481 data-slide=15 title='Example: Automatic Generation of a Quiz'> 1482 15 1483 </a> 1484 </li> 1485 <li> 1486 <a href="#" target="_self" rel='tooltip' 1487 data-slide=16 title='Example: Automatic Generation of a Quiz'> 1488 16 1489 </a> 1490 </li> 1491 <li> 1492 <a href="#" target="_self" rel='tooltip' 1493 data-slide=17 title='Creating <code>HTML5</code> Presentations In <code>R</code>'> 1494 17 1495 </a> 1496 </li> 1497 <li> 1498 <a href="#" target="_self" rel='tooltip' 1499 data-slide=18 title='Example: Interactive Graphics from <a href="http://www.highcharts.com/">Highcharts</a>'> 1500 18 1501 </a> 1502 </li> 1503 <li> 1504 <a href="#" target="_self" rel='tooltip'
1505 data-slide=19 title='More Canadian Weather Data - <code>googleVis</code>'> 1506 19 1507 </a> 1508 </li> 1509 <li> 1510 <a href="#" target="_self" rel='tooltip' 1511 data-slide=20 title='3D plots with <a href="http://cran.r-project.org/web/packages/rgl/index.html"><code>RGL</code></a> and <code>WebGL</code>'> 1512 20 1513 </a> 1514 </li> 1515 <li> 1516 <a href="#" target="_self" rel='tooltip' 1517 data-slide=21 title='<code>Shiny</code>'> 1518 21 1519 </a> 1520 </li> 1521 <li> 1522 <a href="#" target="_self" rel='tooltip' 1523 data-slide=22 title='Example: Functional Regression Modelling'> 1524 22 1525 </a> 1526 </li> 1527 <li> 1528 <a href="#" target="_self" rel='tooltip' 1529 data-slide=23 title='Version Control Systems (VCS)'> 1530 23 1531 </a> 1532 </li> 1533 <li> 1534 <a href="#" target="_self" rel='tooltip' 1535 data-slide=24 title='Why Use Git/GitHub (Even to Work Alone)?'> 1536 24 1537 </a> 1538 </li> 1539 <li> 1540 <a href="#" target="_self" rel='tooltip' 1541 data-slide=25 title='<code>GitHub</code>'> 1542 25 1543 </a> 1544 </li> 1545 <li> 1546 <a href="#" target="_self" rel='tooltip' 1547 data-slide=26 title='A Sampling of Git Commands and Terminology'> 1548 26 1549 </a> 1550 </li> 1551 <li> 1552 <a href="#" target="_self" rel='tooltip' 1553 data-slide=27 title='Managing Citations with <code>RefManageR</code>'> 1554 27 1555 </a> 1556 </li> 1557 <li> 1558 <a href="#" target="_self" rel='tooltip' 1559 data-slide=28 title='Printing example'> 1560 28 1561 </a> 1562 </li> 1563 <li> 1564 <a href="#" target="_self" rel='tooltip' 1565 data-slide=29 title='494 works of R.J. Carroll from Google Scholar'> 1566 29 1567 </a> 1568 </li> 1569 <li> 1570 <a href="#" target="_self" rel='tooltip' 1571 data-slide=30 title='Extract and Update fields'> 1572 30 1573 </a> 1574 </li> 1575 <li> 1576 <a href="#" target="_self" rel='tooltip' 1577 data-slide=31 title='Searching with <code>SearchBib</code> and <code>[</code> Operator'> 1578 31 1579 </a> 1580 </li> 1581 <li> 1582 <a href="#" target="_self" rel='tooltip' 1583 data-slide=32 title='Searching with <code>SearchBib</code> and <code>[</code> Operator'> 1584 32 1585 </a> 1586 </li> 1587 <li> 1588 <a href="#" target="_self" rel='tooltip' 1589 data-slide=33 title='Searching and Setting Options'> 1590 33 1591 </a> 1592 </li> 1593 <li> 1594 <a href="#" target="_self" rel='tooltip' 1595 data-slide=34 title='Citations for <code>RMarkdown</code> and <code>RHTML</code> Docs'> 1596 34 1597 </a> 1598 </li> 1599 <li> 1600 <a href="#" target="_self" rel='tooltip' 1601 data-slide=35 title='Printing the bibliography'> 1602 35 1603 </a> 1604 </li> 1605 <li> 1606 <a href="#" target="_self" rel='tooltip' 1607 data-slide=36 title='Learning More'> 1608 36 1609 </a> 1610 </li> 1611 </ul> 1612 </div> <!--[if IE]> 1613
1613<script 1614 src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"> 1615 </script>
1615 1616
1616<script>CFInstall.check({mode: 'overlay'});</script>
1616 1617 <![endif]--> 1618</body> 1619 <!-- Load Javascripts for Widgets --> 1620
1620<script src="./assets/js/titleclicks.js"></script>
1620 1621 1622 <!-- MathJax: Fall back to local if CDN offline but local image fonts are not supported (saves >100MB) --> 1623
1623<script type="text/x-mathjax-config"> 1624 MathJax.Hub.Config({ 1625 tex2jax: { 1626 inlineMath: [['$','$'], ['\\(','\\)']], 1627 processEscapes: true 1628 } 1629 }); 1630 </script>
1630 1631
1631<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
1631 1632 <!--
1632<script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> 1633 </script>
1633 --> 1634
1634<script>window.MathJax || document.write('
1634<script type="text/x-mathjax-config">MathJax.Hub.Config({"HTML-CSS":{imageFont:null}});<\/script>
1634<script src="libraries/widgets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"><\/script>') 1635</script>
1635 1636<!-- LOAD HIGHLIGHTER JS FILES --> 1637
1637<script src="libraries/highlighters/highlight.js/highlight.pack.js"></script>
1637 1638
1638<script>hljs.initHighlightingOnLoad();</script>
1638 1639 <!-- DONE LOADING HIGHLIGHTER JS FILES --> 1640 1641 </html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.