Read a Line from the Terminal
DESCRIPTION:
Returns a character string which is one line of input.
USAGE:
readline(prompt = "")
OPTIONAL ARGUMENTS:
- prompt
-
A character string to print to remind the user to type something
VALUE:
character string giving the line read from the terminal.
This contains all of the characters typed prior to an
Enter
or
Return
.
DETAILS:
This is useful in writing S-PLUS functions that interact with the user.
EXAMPLES:
ans <- readline("Do you want to continue? ")
if(ans=="n" || ans=="no") return()
reply <- readline()
if(nchar(reply) == 0) break else reply <- as.numeric(reply)