preconditions: Check inputs against known limitations

Description Usage Arguments Details Value Examples

Description

Checking inputs allows code to ‘fail early’ with clear error messages, rather tha failing cryptically later.

Usage

1

Arguments

x

a scalar (length 1) numeric vector to be compared to a random number.

Details

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.

Value

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.

Examples

1

Bioconductor/DDayChallenge documentation built on May 6, 2019, 7:49 a.m.