MLBA Lab 2

An introduction to Quarto

Ilia Azizi

18.03.2024

Motivation

  • Learning about Quarto
    • What are its output formats? Reports (PDF, HTML, Docx), Presentations (PPT, KEY, HTML) & websites (HTML).
  • Learning how to interact with Quarto
    • How can it be used? It can be used with many integrated development environments (IDEs) such as Rstudio, Jupyter Notebook & VSCode.
  • Using what we have seen in class with Quarto
    • Reason(s) to use? Good application for ML course & reporting in general. It particularly benefits interactive reporting, especially when multiple programming languages are involved.

What is Quarto?

  • Quarto® is an open-source scientific and technical publishing system built on Pandoc.
  • Pandoc is a versatile tool for converting documents from one format to another. It allows you to convert a document written in one markup language to another markup language, such as converting a Markdown document to HTML or LaTeX.
  • Think of Quarto as R-markdown on steroids.

Formats

nbdev.fast.ai

Python for Data Analysis, 3E by Wes McKinney

https://jollydata.blog/

The untold story of palmerpenguins by Dr. Kristen Gorman, Dr. Allison Horst, andDr. Alison Hill

Journal of Statistical Software (JSS)

Journal of Statistical Software (JSS)

Compatibility

A screenshot of a Quarto document rendered inside RStudio

A screenshot of a Quarto document rendered inside VSCode

A screenshot of a Quarto document rendered inside JupyterLab

Rstudio Demo

Presentations: Pretty Code

  • Over 20 syntax highlighting themes available
  • Default theme optimized for accessibility
# Define a server for the Shiny app
function(input, output) {
  
  # Fill in the spot we created for a plot
  output$phonePlot <- renderPlot({
    # Render a barplot
  })
}

Presentations: Code Animations

  • Over 20 syntax highlighting themes available
  • Default theme optimized for accessibility
# Define a server for the Shiny app
function(input, output) {
  
  # Fill in the spot we created for a plot
  output$phonePlot <- renderPlot({
    # Render a barplot
    barplot(WorldPhones[,input$region]*1000, 
            main=input$region,
            ylab="Number of Telephones",
            xlab="Year")
  })
}

Presentations: Line Highlighting

  • Highlight specific lines for emphasis
  • Incrementally highlight additional lines
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()

Presentations: Executable Code

library(ggplot2)
ggplot(mtcars, aes(hp, mpg, color = am)) +
    geom_point() + geom_smooth(formula = y ~
    x, method = "loess")

Presentations: Auto-Animate

Automatically animate matching elements across slides with Auto-Animate.

Presentations: Auto-Animate

Automatically animate matching elements across slides with Auto-Animate.

Thank You for your attention!

Questions?

References & Credits