What is this?

This part is just plain markdown document that serves as an exercise book for Danielle Navarro’s Starting R Markdown video series.

Codes!

Let’s put in some codes!

print("hello world!")
## [1] "hello world!"

by default, code chunks exist in two parts: code input and output. Inputs are shown first, and outputs are on the chunk right below it.

Thing to know

YAML

It’s the metadata component of the markdown doc, written as the first chunk on top of everything. See the screenshot below.

Multiple doc output

You can add multiple doc outputs at once, just write the formats in output! (e.g. html_document: default)

Themes

We can also change the theme information (e.g. ‘readable’, ‘spacelab’, etc.). Put this under the document output.

Adding other stuff

You can add table of content (“toc: true”), and also, for HTML, you can add a floating table of content (“toc_float: true”). Looks spiffy, almost like an actual website!

Equations??

Adding equation with markdown is governed using the dollar sign ($):

  • Anything inside a dollar sign is ‘inline’ maths, which will stay in the text lines. (e.g. \(1+1 = 2\))
  • Two dollar signs indicate a standalone equation \[f(x) = ax^2 + b\]
  • Don’t leave out unused spaces in between the dollar signs! Whitespace matters
  • It is based on LaTeX rules (don’t know, never used em!)

How to publish your documents?

Several options:

  • Save your output files (the pdfs and htmls) on online repos (e.g. Gdrive, OSF, Github)
  • Or use the “publish” button on the preview! This will take you to Rstudio Connect or RPubs.

Other stuff I might want to keep in mind

  • Look up cheatsheets
  • Read R Markdown: The Definitive Guide by Yihui Xie et al.
  • Maybe think about some projects I can do to level up
    • Convert the factor analysis reports from the CISDI project to HTML
    • Write the Fake News paper using Rmarkdown
    • Make a dashboard (is this more of a Shiny-based project? might wanna look at Yihui Xie’s book for examples). The dashboard itself can be based on the dataset from Convey 4.

And… that’s all!