Error and Warning Messages

DESCRIPTION:
Issues a message from a function, stop additionally causes the function to be exited.

USAGE:
stop(message="")
warning(message="")

OPTIONAL ARGUMENTS:
message:
character string to be printed.

SIDE EFFECTS:
stop prints the name of the function calling stop followed by message, terminates execution of the current expression, and creates a dump. If message is omitted, the expression is terminated (and dumped) silently.

warning prints a similar warning message at the end of evaluation of the expression, but does not affect execution.


DETAILS:
If too many warning messages are generated in one expression (currently more than five), the messages are stored together in an object in the working directory named last.warning. Only the number of warnings is then printed. The function warnings will print out the stored messages.

The error option (see options) specifies the action to be taken when a dump occurs; the two main choices are discussed in the dump.calls help file.

The warn option controls the behavior when a warning is encountered. Actions range from ignoring the warning message totally (warn=-1), generating the message at the end of the top level expression (warn=0), generating the message immediately (warn=1), or causing the warning to behave as an error (warn=2).


SEE ALSO:
warnings , options , dump.calls .

EXAMPLES:
warning(paste("Rank is", n, "should be", ncol(x)))
if(any(is.na(x))) stop("NAs are not allowed in x")