Learn R Programming

cnd (version 0.1.0)

cnd-cnd-conditions: Conditions for cnd

Description

Conditions for cnd

Arguments

<code>{cnd}</code>

These conditions are made with the {cnd} package though the use of condition().

<code>{cnd}</code> conditions

cnd:as_character_cnd_error/error

package

{cnd}

class

cnd:as_character_cnd_error

type

error

You cannot coerce a condition_generator object to a character. This may have occurred when trying to put a condition function through stop() or warning. Instead, call the function first, then pass the result to stop() or warning().

For example:

# Instead of this
stop(my_condition)

# Do this stop(my_condition())

cnd:cnd_document_conditions/warning

package

{cnd}

class

cnd:cnd_document_conditions

type

warning

no help documentation provided

cnd:cnd_document_file/error

package

{cnd}

class

cnd:cnd_document_file

type

error

no help documentation provided

cnd:cnd_document_pkg_reg/error

package

{cnd}

class

cnd:cnd_document_pkg_reg

type

error

no help documentation provided

cnd:cnd_generated_cleanup/message

package

{cnd}

class

cnd:cnd_generated_cleanup

type

message

no help documentation provided

cnd:cnd_generated_write/condition

package

{cnd}

class

cnd:cnd_generated_write

type

condition

no help documentation provided

cnd:cond_cnd_class/error

package

{cnd}

class

cnd:cond_cnd_class

type

error

cnd() simple calls the appropriate function: stop(), warning(), or message() based on the type parameter from condition().

cnd:condition_message_generator/error

package

{cnd}

class

cnd:condition_message_generator

type

error

condition_generator objects are not conditions. You may have made this mistake:

x <- condition("my_condition")
conditionMessage(x)

Condition generators need to be called first before they can be used as conditions. Try this instead:

x <- condition("my_condition")
conditionMessage(x())

cnd:condition_overwrite/warning

package

{cnd}

class

cnd:condition_overwrite

type

warning

no help documentation provided

cnd:conditions_dots/warning

package

{cnd}

class

cnd:conditions_dots

type

warning

The ... parameter in conditions() is meant for convenience. Only a single argument is allowed. Other parameters must be named explicitly.

For example:

# Instead of this
conditions("class", "package") # "package" is ignored with a warning

# Do this conditions(class = "class", package = "package")

cnd:invalid_condition/error

package

{cnd}

class

cnd:invalid_condition

type

error

The class, exports, and help parameters must be a single character string. If you are passing a function, it must be a valid function.

cnd:invalid_condition_message/error

package

{cnd}

class

cnd:invalid_condition_message

type

error

Conditions messages are displayed when invoked through conditionMessage(). You can set a static message by passing through a character vector, or a dynamic message by passing through a function. The function should return a character vector.

When message is not set, a default "there was an error" message is used.

cnd:match_arg/error

package

{cnd}

class

cnd:match_arg

type

error

Mostly match.arg() but with a custom condition

cnd:no_package_exports/warning

package

{cnd}

class

cnd:no_package_exports

type

warning

The exports parameter requires a package

Details

The following conditions are defined in the {cnd} package.

See Also

cnd-package condition