EVOLUTION-MANAGER
Edit File: warning.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: Warning Messages</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 warning {base}"><tr><td>warning {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Warning Messages</h2> <h3>Description</h3> <p>Generates a warning message that corresponds to its argument(s) and (optionally) the expression or function from which it was called. </p> <h3>Usage</h3> <pre> warning(..., call. = TRUE, immediate. = FALSE, noBreaks. = FALSE, domain = NULL) suppressWarnings(expr) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>zero or more objects which can be coerced to character (and which are pasted together with no separator) or a single condition object.</p> </td></tr> <tr valign="top"><td><code>call.</code></td> <td> <p>logical, indicating if the call should become part of the warning message.</p> </td></tr> <tr valign="top"><td><code>immediate.</code></td> <td> <p>logical, indicating if the call should be output immediately, even if <code><a href="options.html">getOption</a>("warn") <= 0</code>.</p> </td></tr> <tr valign="top"><td><code>noBreaks.</code></td> <td> <p>logical, indicating as far as possible the message should be output as a single line when <code>options(warn = 1)</code>.</p> </td></tr> <tr valign="top"><td><code>expr</code></td> <td> <p>expression to evaluate.</p> </td></tr> <tr valign="top"><td><code>domain</code></td> <td> <p>see <code><a href="gettext.html">gettext</a></code>. If <code>NA</code>, messages will not be translated, see also the note in <code><a href="stop.html">stop</a></code>.</p> </td></tr> </table> <h3>Details</h3> <p>The result <em>depends</em> on the value of <code><a href="options.html">options</a>("warn")</code> and on handlers established in the executing code. </p> <p>If a condition object is supplied it should be the only argument, and further arguments will be ignored, with a message. </p> <p><code>warning</code> signals a warning condition by (effectively) calling <code>signalCondition</code>. If there are no handlers or if all handlers return, then the value of <code>warn = <a href="options.html">getOption</a>("warn")</code> is used to determine the appropriate action. If <code>warn</code> is negative warnings are ignored; if it is zero they are stored and printed after the top–level function has completed; if it is one they are printed as they occur and if it is 2 (or larger) warnings are turned into errors. Calling <code>warning(immediate. = TRUE)</code> turns <code>warn <= 0</code> into <code>warn = 1</code> for this call only. </p> <p>If <code>warn</code> is zero (the default), a read-only variable <code>last.warning</code> is created. It contains the warnings which can be printed via a call to <code><a href="warnings.html">warnings</a></code>. </p> <p>Warnings will be truncated to <code><a href="options.html">getOption</a>("warning.length")</code> characters, default 1000, indicated by <code>[... truncated]</code>. </p> <p>While the warning is being processed, a <code>muffleWarning</code> restart is available. If this restart is invoked with <code>invokeRestart</code>, then <code>warning</code> returns immediately. </p> <p>An attempt is made to coerce other types of inputs to <code>warning</code> to character vectors. </p> <p><code>suppressWarnings</code> evaluates its expression in a context that ignores all warnings. </p> <h3>Value</h3> <p>The warning message as <code><a href="character.html">character</a></code> string, invisibly. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="stop.html">stop</a></code> for fatal errors, <code><a href="message.html">message</a></code> for diagnostic messages, <code><a href="warnings.html">warnings</a></code>, and <code><a href="options.html">options</a></code> with argument <code>warn=</code>. </p> <p><code><a href="gettext.html">gettext</a></code> for the mechanisms for the automated translation of messages. </p> <h3>Examples</h3> <pre> testit <- function() warning("testit") testit() ## shows call testit <- function() warning("problem in testit", call. = FALSE) testit() ## no call suppressWarnings(warning("testit")) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>