Quarto Basics

Author

Graham Owenby

Font Size

Font Size

Font Size

Font Size

Font Size
Font Size

Font Size

Bullet List

  • Item 1

  • Item 2

  • Item 3

Numeric List

  1. Item 1

  2. Item 2

  3. Item 3

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

1 + 1
[1] 2
# You can choose not the show the code when outputting the file.
  # 1. Gear symbol
  # 2. Output drop-down box
  # 3. Show code only

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).

library(tidyverse)

smaller <- diamonds |>
  filter(carat <= 2.5)

smaller |>
  ggplot(aes(x = carat)) +
  geom_bar(binwidth = 0.01)

Figure

Interactive Plots

library(plotly)

data(economics)

plot_ly(
  data = economics,
  x = ~date,
  y = ~unemploy,
  type = "scatter",
  mode = "lines"
) |>
  layout(
    xaxis = list(title = "Date"),
    yaxis = list(title = "Number of Unemployed")
  )
plot_ly(data = economics,
        x = ~unemploy,
        type = "histogram")
library(leaflet)

leaflet() |>
  addTiles() |>
  addMarkers(lng = -84.39,
             lat = 33.75,
             popup = "Atlanta")
leaflet() |>
  addTiles() |>
  addMarkers(lng = -84.5184,
             lat = 33.9384,
             popup = "KSU Marietta")

Tables

subcars <- mtcars[1:5, 1:4]

knitr::kable(subcars,
             col.names = c("Miles/Gallon", "Cylinders", "Eng Displacement", "Horsepower"),
             row.names = F,
             caption = "Car Data")
Car Data
Miles/Gallon Cylinders Eng Displacement Horsepower
21.0 6 160 110
21.0 6 160 110
22.8 4 108 93
21.4 6 258 110
18.7 8 360 175

Interactive Tables

library(DT)

datatable(mpg)

QR Codes

library(qrcode)

qr <- qr_code("https://rpubs.com/GrahamOwenby/1424261")

plot(qr)