-
Notifications
You must be signed in to change notification settings - Fork 4
/
script-sample.Rmd
85 lines (61 loc) · 2.01 KB
/
script-sample.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: Talk of Talks
date: Day of the Talk
mainfont: Hoefler Text
output:
scuro::scuro_md:
highlight: zenburn
---
```{r setup, include=F, cache=F}
# load your favorite libraries
library(knitr) # for kable (see below)
library(ggplot2)
```
# for written-out talks...
> - text slide with an incremental
> - build
::: noslide
Sometimes you want to speak from a written-out script rather than notes. This file demonstrates this approach. Text that goes only in the script, and not on slides, should be placed in a pandoc Div delimited by `::: noslide` and `:::`.
Incremental builds are collapsed in the script as well.
:::
# an example table
```{r}
kable(mtcars[1:5, 1:5],
caption="Something about cars")
```
# an example graphic
```{r graph, fig.cap="I think that I shall never see"}
ggplot(trees, aes(Girth, Height)) +
geom_point(color="white")
```
# ugly examples of custom placement and sizing
```{r displaced, textblock_width=2.75, textblock_pos=c(0, 1), fig.height=3, fig.width=2, out.height=4, center=T}
p <- ggplot(mtcars, aes(factor(cyl))) +
geom_bar(color="white", fill="grey40") +
xlab("Another car thing")
p
```
\begin{textblock}{2.75}(3,2)
Look! a dodgy three-column layout!
With great layout power comes great, etc., etc.
\end{textblock}
\begin{textblock}{2.75}(6,1)
```{r displaced-over, inside_textblock=T, center=T, out.width=2.75}
p
```
Text scaling: \\
a cautionary tale.
\end{textblock}
\vspace{8\TPVertModule}
::: noslide
On the script, the `textpos` grid is shrunk down. Note too that `textblock`s take up no vertical space, so to prevent overprinting in the script you must manually insert some vertical space with `\vspace`. Extra vertical space at the bottom of a slide will have no effect on the slide output (just the script).
:::
# example code display
```{r code, echo=T}
cor(anscombe$x1, anscombe$y1)
cor(anscombe$x2, anscombe$y2)
```
Definitely don't need to visualize.
::: noslide
Nonetheless, don't think plotting the data is synonymous with analyzing it. Let's discuss....
:::