+ - 0:00:00
Notes for current slide
Notes for next slide

Reproducible reporting with RMarkdown


Dr Thiyanga S. Talagala

University of Sri Jayewardenepura

IASSL Workshop- 21/ 25 February, 2022

1 / 61

Packages

install.packages("rmarkdown")

install.packages("knitr")

2 / 61

Packages

install.packages("rmarkdown")

install.packages("knitr")

Additional packages

install.packages("tidyverse")

2 / 61
3 / 61
4 / 61
5 / 61
6 / 61
7 / 61
8 / 61
9 / 61
10 / 61
11 / 61
12 / 61
13 / 61
14 / 61
15 / 61
16 / 61
17 / 61

Creating an R Markdown document

18 / 61
19 / 61
20 / 61
21 / 61

Demonstration

22 / 61
23 / 61

Customizing your R Markdown document: text

24 / 61
25 / 61
26 / 61
27 / 61
28 / 61
29 / 61
30 / 61
31 / 61
32 / 61
33 / 61
34 / 61
35 / 61
36 / 61

Change Header

Code

# Header 1
## Header 2
### Header 3

Output

Header 1

Header 2

Header 3

37 / 61

Add content

Code

# Header 1
This is section 1.
## Header 2
This is section 1.2
### Header 3
This is section 1.2.1

Output

Header 1

This is section 1.

Header 2

This is section 1.2

Header 3

This is section 1.2.1

38 / 61

Text formatting

Code

text

Output

M1: This text is in italics.

M2: This is also italics.

M3: This text is in bold.

M4: This is also bold.

This text is strikethrough.

39 / 61

Include R codes

40 / 61
41 / 61

Anatomy of R Markdown

42 / 61

Anatomy of R Markdown

code chunk

43 / 61
44 / 61

Anatomy of R Markdown

Text

45 / 61
46 / 61

Anatomy of R Markdown

YAML

HTML Document

47 / 61
48 / 61

Anatomy of R Markdown

YAML

PDF Document

49 / 61
50 / 61
51 / 61

Anatomy of R Markdown

YAML

Word Document

52 / 61
53 / 61
54 / 61

Chunk options

55 / 61

fig.width/ fig.height

56 / 61

fig.width/ fig.height

57 / 61

echo [TRUE/ FALSE]

58 / 61

eval [TRUE/ FALSE]

59 / 61

Chunk options

  • eval = FALSE - prevent the code from being evaluated

  • include = FALSE - run the code but doesn't show it in the final document

  • echo = FALSE - prevent the code but not the results from appearing

  • message = FALSE - prevent messages from appearing in the finished file

  • results = "hide" - hide the printed output

  • error = TRUE - cause the render to continue even if the code returns an error

  • comment=NA - remove # from the output

60 / 61

Chunk options

  • eval = FALSE - prevent the code from being evaluated

  • include = FALSE - run the code but doesn't show it in the final document

  • echo = FALSE - prevent the code but not the results from appearing

  • message = FALSE - prevent messages from appearing in the finished file

  • results = "hide" - hide the printed output

  • error = TRUE - cause the render to continue even if the code returns an error

  • comment=NA - remove # from the output

Without comment=NA

a <- 1:5; a
## [1] 1 2 3 4 5

With comment=NA

a <- 1:5; a
[1] 1 2 3 4 5
60 / 61

Thank you

Make some VOICE using R Makrkdown!

Additional Resources https://talks-thiyanga.netlify.app/rmarkdown_rladies/rmarkdownrladies_tst#1

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

61 / 61

Packages

install.packages("rmarkdown")

install.packages("knitr")

2 / 61
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow