Week 3 qmd skills

Author

Matt Crump

Published

February 8, 2023

1 Make new qmds

  1. Be able to make a new .qmd document

Yes, I can do this.

  • use the top-right green plus icon
  • from the file menu
  • from the file tab choose green plus icon.

2 render qmds

  1. Be able to render a .qmd document
  • Press render button.

Explain the difference between the source editor view and visual editor view in Rstudio.

Source shows plain text. Visual editor shows rendered markdown text.


Simple markdown

  1. Be able to insert simple markdown plain text (headers, lists, paragraphs), and render the document.

This is some plain text.


3 Markdown resources

3.1 a second level

  1. Be aware of resources to help you learn more about markdown options.

italics and bold

superscript2 / subscript2

Test10

Test2302403

strikethrough

asdf ads fdsaf das fas fsad fa sdfa ds

verbatim code

Let’s say I’m writing about the ggplot2 library.

https://quarto.org

Quarto

This is an elephant

  • unordered list
    • sub-item 1
    • sub-item 2
      • sub-sub-item 1
Right Left Default Center
12 12 12 12
123 123 123 123
1 1 1 1
Put our code in here
1 + 1
a <- 1
b <- 3
# some comments

\(x=1\)

\(E = mc^{2}\)


  1. Be able to insert an R code chunk, and show the output in the rendered document.
  • macro for quick insert
2+2
[1] 4

mac - “option-command-i” windows - Ctrl-Alt-I

  1. Running R code chunks in a qmd
  • pressing play
  • copy/paste into console
  • highlight then command-enter (mac)
  • precedence issues (first to last)
  1. Be aware of R code chunk options, and how to use eval, messages, error, warning, and echo.
hist(mtcars$mpg)

"b" + 5 
Error in "b" + 5: non-numeric argument to binary operator
library(dplyr)
hist(mtcars$mpg)

  1. Be able to set code chunk options per chunk, and/or for the whole document. Understand rules for precedence (which options will apply if both are set.)

Yes! Use execute in top-level yml, chunk options have precedence over global options.

  1. Write inline r code.

2

a <- 54
b <- 100

c <- a+b

The value of c is 154.

  1. Explain how the rendering environment is different from the Rstudio environment.
c <- a+b
c
[1] 154
  1. Be aware of more advanced quarto options for html documents, and try some of the options.