Description Usage Arguments Details Value Author(s) See Also Examples
Display a prompt and collect the user's response
1 |
msg |
Character vetor providing the message to be displayed |
con |
Character connection to query, defaults to |
The prompt message will be displayed, and then readLines
is
used to collect a single input value (possibly empty), which is then
returned.
In most situations using the default con=stdin()
should work
properly. Under RStudio, it is necessary to specify
con=file("stdin")
for proper operaation.
A character scalar containing the input providede by the user.
Gregory R. Warnes greg@warnes.net
1 2 3 4 5 6 7 8 9 | # 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")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.