Skip to contents

This function takes an input vector and validates it to ensure that it meets certain criteria.

Usage

getValidDispersion(input_vector)

Arguments

input_vector

A vector to be validated.

Value

A validated and filtered numeric vector.

Details

The function checks whether the input is a vector, suppresses warnings while converting to numeric, and filters out non-numeric elements. It also checks for values greater than zero and removes negative values. If the resulting vector has a length of zero, an error is thrown.

Examples

getValidDispersion(c(0.5, 1.2, -0.3, "invalid", 0.8))
#> Non-numeric elements were removed from the dispersion vector
#> Negative numeric values were removed from the dispersion vector
#> [1] 0.5 1.2 0.8