## Drip feed the R script example-script.R to stdout(), one character at a time code <- readLines("example-script.R") start <- proc.time() elapsed <- (proc.time() - start)[3] ## Contract blank lines and collapse to single line with '\n's chars <- paste(gsub("^ +$", "", code), collapse="\n") if (nchar(chars)) { ## Simulate typing for (j in 1:nchar(chars)) { char <- substr(chars, j, j) writeLines(char, stdout(), sep="") ## Don't delay over spaces (esp. indenting) if (char != " ") { Sys.sleep(.1) } } }