Paul E. Johnson
YAML = Yet Another Markdown Language
--- title: "Rmd on Rmd" ---
output: slidy_presentationslidy_presentation is convenient, but not strictly necessary. Selector could be included in a script that does post-processing instead.
Daring Fireball: http://daringfireball.net/projects/markdown/syntax
RStudio Docs: https://support.rstudio.com/hc/en-us/articles/200486468-Authoring-R-Presentations
User writes document in markdown, calls file “mgp.md” (my great presentation)
pandoc -t S5 mpg.md -o mgp.html2 . Make a PDF slideshow in beamer format
pandoc -t beamer mgp.md -V theme:Warsaw -o mgp.pdf
See Producing slide shows with Pandoc by John Macfarlane, who has been a key contributor in the markdown movement.
` ` `{r option-option-option}
rcode here
` ` `
<>= rcode here @
knit: convert Rmd to md The markdown file is run and the code chunks are–literally–replaced with R input and output.
Can be done in various ways. Most direct
1R CMD knit mgp.Rmd2
R -e "library(knitr); knit(\"mgp.Rmd\")"
pandoc: convert the new md into HTML or PDF or whatnot
R -e “library(rmarkdown); render("mgp.Rmd")”
render
function. The RStudio documents on what is going on, they are putting their own spin on it.<img src="importfigs/Fumble-Chart-1.png" width="700" alt="Fumbles">
The slide argument {.allowframebreaks} is based on the LaTeX Beamer argument, it is intended to solve this problem
However the ioslides_presentation converter in pandoc does not respect .allowframebreaks, which is a crushing disappointment.
The slidy_presentation is not quite so polished as ioslides, but it DOES respect .allowframebrakes. I used one in the “Understand the Process Slide Above”.
can have knitr call formatR to reformat code with line wrapping.
Since formatR fails on about 25% of the code examples I run through it, this is not a perfect solution.
Manipulate the R output. In R, run this at the start of the session
options(width = 70)
to keep line output shorter. This solution works dependably.
Apparently unsolveable problem.
Can be removed. It is discussed here http://stackoverflow.com/questions/15081212/remove-hashes-in-r-output-from-rmarkdown-and-knitr
I confirm on next slide that does work one slide at a time
Have not found document-wide solution yet. Person there asserts this will erase the point signs, opts_chunk$set(comment = NA), but I don’t know where how to use that
dat <- data.frame(x1 = rnorm(100), y1 = rnorm(100))
print(dat)
x1 y1
1 -0.024779 -0.532615
2 -0.595708 -0.065403
3 -0.679282 -0.175966
4 0.016064 1.250413
5 -0.063805 -0.508312
6 -1.608321 -0.618807
7 -0.841354 -1.166242
8 -0.343233 0.688238
9 0.969689 0.304409
10 -0.232601 0.298952
11 -0.326746 0.192090
12 -1.274201 0.470676
13 0.341392 -0.424203
14 0.402024 -0.568133
15 1.296188 0.488586
16 -0.050726 -1.180882
17 0.843548 0.286996
18 0.188009 0.958711
19 -1.230055 0.130812
20 -0.181701 0.108920
21 1.666027 -0.130299
22 -0.360731 -1.528802
23 -0.011685 -0.482568
24 2.405842 -0.463031
25 0.593297 -1.436603
26 0.605710 -1.723115
27 -0.530536 -2.544667
28 -0.047831 -0.384994
29 -0.179572 -0.837010
30 -0.246159 0.762408
31 0.273934 1.794685
32 -0.119660 0.110273
33 -0.595599 -0.247153
34 0.238085 0.768608
35 0.654706 -0.578918
36 1.134818 -0.652662
37 0.639108 0.733875
38 -0.692816 0.907084
39 0.486734 -1.450094
40 1.444495 0.836457
41 0.336546 -0.781412
42 -0.435300 -1.768317
43 1.881777 -0.381787
44 1.492625 -1.013744
45 -0.041094 0.126990
46 -2.897957 -0.262404
47 1.000007 -1.415912
48 0.850069 0.587383
49 -1.703858 0.337869
50 -0.651114 -2.093873
51 0.185027 -0.277187
52 2.250010 -1.325448
53 0.782664 -0.403607
54 0.024567 0.619302
55 1.197839 -1.828095
56 0.745664 -0.127138
57 0.734189 -0.051966
58 0.093099 -0.411510
59 0.530404 -1.059356
60 0.190963 -1.120711
61 0.227050 1.567924
62 -0.616940 0.141238
63 1.448590 0.895315
64 -2.031631 0.685063
65 1.264764 -0.538453
66 0.012714 2.189421
67 0.486739 -0.481019
68 2.371039 -1.239347
69 1.217416 -0.969725
70 0.785134 -0.763601
71 0.430800 -1.683312
72 1.530047 0.434939
73 0.003901 0.025294
74 0.209648 -0.565944
75 -1.425481 -0.012462
76 -0.420065 0.435284
77 -0.570460 -1.994284
78 0.024647 -0.097332
79 -0.203127 -2.010018
80 -0.095364 -0.153945
81 -0.557543 0.195889
82 -0.313085 -0.421158
83 0.344355 1.455487
84 0.339508 0.365507
85 0.373399 -0.348570
86 1.513025 0.458718
87 -0.244489 -1.520692
88 -1.850653 -0.290735
89 -1.288580 0.545778
90 -0.477307 -0.774239
91 1.522609 -0.001126
92 0.251029 1.831316
93 -0.636104 1.058433
94 -0.139130 -0.213064
95 0.450503 1.697548
96 0.262357 1.495269
97 0.282939 0.156782
98 0.252195 0.516725
99 -1.003409 -0.400118
100 -0.942661 0.013978
This is a LaTeX strongpoint that I find lacking in the markdown approach.
Sweave has a “split” feature where we can drop all the generated figures and LaTeX output into a folder, and then later insert those things when we want them.
Especially since 2 columns does not tolerate R code embedded, such a feature would be especially helpful
Also, I want to insert same figures into a writeup.
Very difficult to un-do the cleanup effort of render here.