Last data update: 2014.03.03
R: Display a prompt and collect the user's response
Display a prompt and collect the user's response
Description
Display a prompt and collect the user's response
Usage
ask(msg = "Press <RETURN> to continue: ")
Arguments
msg
Character vetor providing the message to be displayed
Details
The prompt message will be displayed, and then readLines
is
used to collect a single input value (possibly empty), which is then
returned.
Value
A character scalar containing the input providede by the user.
Author(s)
Gregory R. Warnes greg@warnes.net
See Also
readLines
, scan
Examples
# use default prompt
ask()
silly <- function()
{
age <- ask("How old aroe you? ")
age <- as.numeric(age)
cat("In 10 years you will be", age+10, "years old!\n")
}
Results