readline
Read a Line from the Terminal

Description

Returns a character string that is one line of input.

Usage

readline(prompt = "")

Arguments

prompt a character string to print to propmt the user to provide input.

Details

This function is useful for writing functions that interact with the user.
Value
returns a character string giving the line read from the terminal. This string contains all characters typed prior to an Enter or Return, except leading and trailing spaces and tabs, which are stripped. If readline is called from non-interactive mode (for example, from a batch script), it returns an empty character string.
See Also
readLines
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)

Package base version 6.1.1-7
Package Index