tmessage {berryFunctions}R Documentation

messages with call trace

Description

message, warning or stop with a call trace prepended

Usage

tmessage(..., skip = 0)

twarning(..., skip = 0, call. = FALSE, noBreaks. = TRUE)

tstop(..., skip = 0, call. = FALSE)

Arguments

...

Passed to message, warning or stop

skip

Number of tracing levels to exclude. Default: 0

call.

include twarning/tstop call? DEFAULT: FALSE (unlike the originals)

noBreaks.

reduce line breaks if options(warn=1)? DEFAULT: TRUE (unlike the original)

Value

NULL, as per message, warning or stop

See Also

traceCall for the generation of the trace

Examples

lower <- function(a, s) {tmessage("some stuff with ", a+10, skip=s); a}
upper <- function(b, skip=0) lower(b+5, skip)
upper(3) # upper -> lower: some stuff with 18
upper(3, skip=1) # no "lower" in trace
upper(3, skip=-1) # upper -> lower -> tmessage: some stuff with 18
tmessage("Some message", " to be displayed")
lower <- function(a, s) {twarning("some stuff with ", a+10, skip=s); a}
upper(7)
oop <- options(warn=1)
upper(7) # Warning: upper -> lower: some []       no line break :)
options(oop) ; rm(oop)
lower <- function(a, s) {tstop("some stuff with ", a+10, skip=s); a}
try(  upper(7)  ) # Error : try -> upper -> lower: some stuff with 22

[Package berryFunctions version 1.22.0 Index]