The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Using typeR with Quarto Presentations

library(typeR)

Overview

The typeR package provides excellent support for Quarto presentations, allowing you to create engaging live coding demonstrations for:

Quick Start

1. Create a Quarto Presentation

First, create a Quarto presentation file with reveal.js format:

# ---
# title: "My R Demo"
# format: revealjs
# ---

## Slide 1

# ```{r}
# x <- 1:10
# mean(x)
# ```
# 

## Slide 2

# ```{r}
# plot(x, x^2)
# ```
# 

Save this as my-demo.qmd.

2. Run with typeRun()

# Basic usage
typeRun("my-demo.qmd")

# With custom settings
typeRun("my-demo.qmd", delay = 0.08, jitter = 0.02)

What happens:

Included Examples

The package includes ready-to-use Quarto presentation examples:

# Find the example file
demo_file <- system.file("examples/demo-presentation.qmd", package = "typeR")

# Run it
typeRun(demo_file)

# Or the simpler version
simple_file <- system.file("examples/simple-presentation.qmd",
                           package = "typeR")
typeRun(simple_file, delay = 0.05)

Supported Quarto Formats

typeR works with various Quarto presentation formats:

reveal.js (Default)

format: revealjs

Most popular format for HTML presentations. Supports themes, transitions, and interactive features.

PowerPoint

format: pptx

While the typing effect works during development, the final PowerPoint won’t show animation.

Beamer (PDF)

format: beamer

LaTeX-based PDF slides. typeRun() helps during development to test code.

Best Practices

1. Adjust Typing Speed

For presentations, slower typing is often better:

# Slower for readability
typeRun("presentation.qmd", delay = 0.10, jitter = 0.03)

# Very slow for teaching
typeRun("presentation.qmd", delay = 0.15, jitter = 0.05)

# Fast for quick demos
typeRun("presentation.qmd", delay = 0.03, jitter = 0.01)

2. Control Output Length

Prevent long outputs from scrolling off screen:

# Limit to 5 lines
typeRun("presentation.qmd", max_print = 5)

# Show more for detailed examples
typeRun("presentation.qmd", max_print = 15)

3. Use Interactive Pause

During live presentations, pause to answer questions:

typeRun("presentation.qmd")
# Press ESC to pause
# Enter 1 to resume
# Enter 2 to stop

4. Test Before Presenting

Always do a full run-through before your actual presentation:

# Full test run
typeRun("my-talk.qmd", delay = 0.05)

# Check for errors or unexpected output

Example: Full Presentation Workflow

Step 1: Create Content

---
title: "Data Analysis in R"
format: 
  revealjs:
    theme: moon
    transition: slide
---

## Introduction

Today we'll analyze the mtcars dataset.

## Load Data

# ```{r}
# data(mtcars)
# head(mtcars, 3)
# ```

## Summary Statistics

# ```{r}
# summary(mtcars$mpg)
# ```

## Visualization

# ```{r}
# plot(mtcars$wt, mtcars$mpg,
#      xlab = "Weight", ylab = "MPG",
#      main = "Fuel Efficiency vs Weight")
# ```

## Model

# ```{r}
# model <- lm(mpg ~ wt, data = mtcars)
# summary(model)
# ```

Step 2: Practice

# Save the above as "data-analysis.qmd"
typeRun("data-analysis.qmd", delay = 0.06, max_print = 8)

Step 3: Present Live

During your presentation:

  1. Open R/RStudio
  2. Load typeR: library(typeR)
  3. Run: typeRun("data-analysis.qmd", delay = 0.08)
  4. Let the code type out automatically
  5. Use ESC to pause for questions

Advanced Features

Custom Environment

Keep your workspace clean by using a separate environment:

# Create isolated environment
demo_env <- new.env()

# Run presentation in that environment
typeRun("presentation.qmd", envir = demo_env)

# Your global environment remains clean
ls()  # Nothing added here
ls(demo_env)  # All demo objects here

Combining Multiple Presentations

# Run a series of short demos
demos <- c("intro.qmd", "advanced.qmd", "qa.qmd")

for (demo in demos) {
  cat("\n\n=== Starting:", demo, "===\n\n")
  typeRun(demo, delay = 0.06)
  cat("\n\n=== Finished:", demo, "===\n\n")
}

Tips for Success

Do’s ✅

Don’ts ❌

Troubleshooting

Issue: Code types too fast

Solution: Increase the delay parameter

typeRun("presentation.qmd", delay = 0.12)

Issue: Output is too long

Solution: Use max_print or modify your code to show less

typeRun("presentation.qmd", max_print = 5)

Issue: Need to stop mid-presentation

Solution: Press ESC, then choose option 2

Issue: Plots don’t display

Solution: Make sure your graphics device is open and functioning

# Test graphics device
plot(1:10)  # Should work before starting typeRun

Real-World Use Cases

Teaching a Course

# Week 1: Basics
typeRun("week1-intro.qmd", delay = 0.10)

# Week 2: Data manipulation
typeRun("week2-dplyr.qmd", delay = 0.08)

# Week 3: Visualization
typeRun("week3-ggplot.qmd", delay = 0.08)

Conference Talk

# 20-minute presentation
typeRun("conference-talk.qmd", 
        delay = 0.06,     # Fast enough to keep pace
        max_print = 6)    # Brief outputs

Workshop

# Interactive 2-hour workshop
typeRun("workshop-morning.qmd",
        delay = 0.09,      # Slower for learning
        max_print = 8)

# Break, then afternoon session
typeRun("workshop-afternoon.qmd",
        delay = 0.09,
        max_print = 8)

Getting Help

Conclusion

typeR makes Quarto presentations more engaging and professional. The combination of:

Makes it an excellent tool for anyone presenting R code.

Happy presenting! 🎉

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.