Skip to contents

This function is used to detect any numeric values from a string.

Usage

detect_numeric_value(value, num_type = "any", stop_message = FALSE)

Arguments

value

Input string

num_type

Numeric value type: `any`, `positive` or `negative`, Default: 'any'

stop_message

A Boolean value to return a stop message when there is the specified numeric value type `num_type`, Default: `FALSE`

Value

A Boolean value or a stop message if stop_message=TRUE:

TRUE

If any of the specified numeric type value is presented.

FALSE

Otherwise

Examples

if (FALSE) { # \dontrun{
string1 <- c("-2", "1", "1", "-1")
string2 <- c("ADNI1", "ADNI2", "ADNIGO")
detect_numeric_value(value = string1, num_type = "any")
detect_numeric_value(value = string2, num_type = "any")
detect_numeric_value(value = string1, num_type = "negative")
detect_numeric_value(value = string1, num_type = "positive", stop_message = TRUE)
} # }