| new_condition | R Documentation |
Template for a new condition. See more at base::conditions
new_condition(
msg = "",
class = NULL,
call = NULL,
type = c("error", "warning", "message", NA_character_),
message = msg,
pkg = package()
)
msg, message |
A message to print |
class |
Character string of a single condition class |
call |
A call expression |
type |
The type (additional class) of condition: |
pkg |
Control or adding package name to condition. If |
The use of .packageName when pkg = TRUE may not be valid during
active development. When the attempt to retrieve the .packageName object
is unsuccessful, the error is quietly ignored. However, this should be
successful once the package is build and functions can then utilize this
created object.
A condition with the classes specified from class and type
# empty condition
x <- new_condition("informative error message", class = "foo")
try(stop(x))
# with pkg
x <- new_condition("msg", class = "foo", pkg = "bar")
# class contains multiple identifiers, including a "bar:fooError"
class(x)
# message contains package information at the end
try(stop(x))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.