1 Test File of R Markdown

1.1 R Notebook

This is an R Markdown file ‘test-rmarkdown.Rmd’ with various output formats, created using ‘RNotebook_Template.Rmd’. When you execute or run a code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button, a triangle pointing right, within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter (Win) or Cmd+Shift+Enter (Mac).

1.2 Test Code Chunk (1)

head(cars)

1.3 Test Code Chunk (2)

plot(cars)

1.4 Test Code Chunk (3)

knitr::kable(iris[1:6, ])

1.5 Test Code Chunk (4)

ggplot(iris, aes(x = Petal.Length, y = Petal.Width, col = Species)) +
  geom_point()

1.6 New Code Chunk

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Option+I (Win) or Cmd+Option+I (Mac).

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K (Win) or Cmd+Shift+K (Mac) to preview the HTML file).


The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.

1.7 YAML for Various Output Formats

output:
  html_notebook:
    number_sections: yes
  html_document:
    df_print: paged
    number_sections: yes
  word_document: 
    number_sections: yes
  pdf_document: 
    number_sections: yes
  powerpoint_presentation: default
  ioslides_presentation:
    widescreen: yes
    smaller: yes
  slidy_presentation: default
  beamer_presentation: default

2 Note

2.1 Comments on Presentation Formats

  • For slides, a new slide starts at ##, the second-level heading.
  • --- is page break for presentation formats.
  • For Word and Powerpoint, you can add your template. See the documents in References

2.2 References

LS0tCnRpdGxlOiAiVGVzdGluZyBSIE1hcmtkb3duIEZvcm1hdHMiCmF1dGhvcjogIkRTLVNMIgpkYXRlOiAiYHIgU3lzLkRhdGUoKWAiCm91dHB1dDoKICBodG1sX25vdGVib29rOgogICAgbnVtYmVyX3NlY3Rpb25zOiB5ZXMKICBiZWFtZXJfcHJlc2VudGF0aW9uOiBkZWZhdWx0CiAgcGRmX2RvY3VtZW50OiAKICAgIG51bW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