R/ask.if.R

ask.if <-
function (prompt = "Continue? ") 
{
    if (!interactive() || (exists(".Batch") && .Batch)) 
        return(TRUE)
    repeat {
        cat(prompt)
        ans <- readline()
        invisible()
        if (ans == "y" | ans == "yes") 
            return(TRUE)
        if (ans == "n" | ans == "no") 
            return(FALSE)
        cat("Answer y or n\n")
    }
}
Auburngrads/SMRD documentation built on Sept. 14, 2020, 2:21 a.m.