Friday 20 May 2016

Pausing an R Script for User Input

Cited from Pausing an R script: a generic pause function

pause = function(){
    if (interactive()) {
        invisible(readline(prompt = "Press <Enter> to continue..."))
    }
    else {
        cat("Press <Enter> to continue...")
        invisible(readLines(file("stdin"), 1))
    }
}

No comments:

Post a Comment