File: ask.Rd

package info (click to toggle)
gtools 2.6.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 328 kB
  • ctags: 5
  • sloc: asm: 127; ansic: 69; makefile: 1
file content (36 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
\name{ask}
\alias{ask}
\title{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{
  \item{msg}{Character vetor providing the message to be displayed}
}
\details{
  The prompt message will be displayed, and then \code{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{Gregory R. Warnes \email{greg@warnes.net}}
\seealso{ \code{\link{readLines}}, \code{\link{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")
}
   
}
\keyword{IO}