# Create a temporary R script for demonstration
tmp <- tempfile(fileext = ".R")
writeLines(c(
"# Simple calculation",
"x <- 1:5",
"print(mean(x))",
"y <- x^2",
"print(sum(y))"
), tmp)
# Type and run with fast animation (for quick testing)
# \donttest{
typeRun(tmp, delay = 0.01, max_print = 5)
# }
# Clean up
unlink(tmp)
# Interactive examples with real files
if (interactive()) {
# Type and run a simple R script
typeRun("analysis.R")
# Type and run with slower, more dramatic effect
typeRun("demo.R", delay = 0.1, jitter = 0.02)
# Type and run a Quarto document with limited output
typeRun("report.qmd", max_print = 5)
}
Run the code above in your browser using DataLab