Description Usage Arguments Details Value Examples
Checking inputs allows code to ‘fail early’ with clear error messages, rather tha failing cryptically later.
1 |
x |
a scalar (length 1) numeric vector to be compared to a random number. |
Update the code below to check that the variable used in the
if
is scalar, to avoid a mysterious message “the
condition has length > 1 and only the first element will be
used”. Use stopifnot()
as a convenient way to test the pre-
conditions.
Find examples on the Bioconductor support site where this error has confused users.
A scalar numeric vector. If the input is greater than a random normal deviate, the return value is the random normal deviate. Otherwise, the return value is the orignal input.
1 | preconditions(.1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.