EVOLUTION-MANAGER
Edit File: readline.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Read a Line from the Terminal</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for readline {base}"><tr><td>readline {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Read a Line from the Terminal</h2> <h3>Description</h3> <p><code>readline</code> reads a line from the terminal (in interactive use). </p> <h3>Usage</h3> <pre> readline(prompt = "") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>prompt</code></td> <td> <p>the string printed when prompting the user for input. Should usually end with a space <code>" "</code>.</p> </td></tr> </table> <h3>Details</h3> <p>The prompt string will be truncated to a maximum allowed length, normally 256 chars (but can be changed in the source code). </p> <p>This can only be used in an <a href="interactive.html">interactive</a> session. </p> <h3>Value</h3> <p>A character vector of length one. Both leading and trailing spaces and tabs are stripped from the result. </p> <p>In non-<a href="interactive.html">interactive</a> use the result is as if the response was RETURN and the value is <code>""</code>. </p> <h3>See Also</h3> <p><code><a href="readLines.html">readLines</a></code> for reading text lines from connections, including files. </p> <h3>Examples</h3> <pre> fun <- function() { ANSWER <- readline("Are you a satisfied R user? ") ## a better version would check the answer less cursorily, and ## perhaps re-prompt if (substr(ANSWER, 1, 1) == "n") cat("This is impossible. YOU LIED!\n") else cat("I knew it.\n") } if(interactive()) fun() </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>