install.packages('prettydoc')
R Markdown advanced
A powerful and amazing tool for academic communication
Dr. Peng Zhao (✉ peng.zhao@xjtlu.edu.cn)
Department of Health and Environmental Sciences
Xi’an Jiaotong-Liverpool University
1 Learning objectives
- Generate academic manuscripts, theses, and slides with R Markdown.
- Present statistics results in statements, tables, and graphs.
- Use cross references in scientific writing.
2 Forms of Academic communication
Forms | Description | Advantages | Limitation |
---|---|---|---|
Talks | Presenting data orally, usually with slides. | Vivid with animations and universal in various occasions. | Time limit. Electronic devices based. Dependence on the presenter’s improvisation. |
Journal papers | Presenting data with a completed study and published it in a academic journal. | Professional, detailed, strict, and structured. | Requirement changes over publishers. Less interaction with readers. |
Posters | Presenting data with a designed poster and discuss it with other people. | Convenient, instant with interaction. | Space limit. Dependence on the presenter’s explanation. |
R Markdown family:
2.1 Report
2.1.1 The default settings
2.1.2 The prettydoc
package
- Installation
Create: RStudio - File - New File - R Markdown - From Template - Lightweight and Pretty Document (HTML) (prettydoc)
Knit into .html
2.2 Journal paper
2.2.1 The rticles package
- Create: RStudio - File - New File - R Markdown - From Template - Elsevier Journal Article (rticles)
- Knit into .pdf
2.3 Thesis
2.3.1 The bookdown package
- Create a bookdown project: RStudio - File - New Project - New Directory - Book project using bookdown
- Build the book
2.4 Slides
2.4.1 The default settings
- Create: RStudio - New File - R Markdown - Presentation
- Knit it into .html, .pdf, .pptx
2.4.2 The xaringan package
- Create: RStudio - File - New File - R Markdown - From Template - Ninja Presentation (xaringan)
- Knit into .pdf
2.5 More
- Journal paper: RStudio —> File —> New File —> R Markdown —> From Template
- Dissertation/book: RStudio: File ➞ New Project ➞ New Directory ➞ Book Project using bookdown
- slides: RStudio: File ➞ New File ➞ R Markdown ➞ From Template ➞ Ninja Presentation
- Poster: RStudio: File ➞ New File ➞ R Markdown ➞ From Template ➞ drposter Poster
- Website: RStudio: File ➞ New Project ➞ New Directory ➞ Website using blogdown
- CV
- Letter
- Music
- Chess
- Mindmap
- …
3 R Markdown header
Output:
output:
bookdown::pdf_book: default
bookdown::html_document2: default
bookdown::word_document2: default
Titles:
title: Presenting statistical results
subtitle: A demonstration for R Markdown
author: Peng Zhao
Table of contents:
toc: false
lot: false
lof: false
Citations:
link-citations: true
colorlinks: yes
bibliography: references.bib
4 Presenting statistical results
Demo.
5 Citations & references
- Bibliography library: .bib
- Use Google/Baidu/Bing Scholar for searching a topic of your interest, and download the bib entry for an article.
- Download a bib entry from one journal of your interest.
- Merge these two files into one.
- Cite these two references in your draft.
- Citation style
- Citation:
[@entry]
.
6 Further readings
7 Exercises
- Convert this document into a prettydoc document. What themes can you use for it?
- Improve the R Markdown slides with appropriate forms, including statements, tables, and graphs. If necessary, use xaringan.
- Group work: The ENV221 book.
- Each group claims one week’s teaching document.
- Create a bookdown project. Convert each teaching document into a book chapter. Take care of the cross references for equations, tables, and graphs.
- Merge all the chapters into one.