has_mixed_signs: Check for Mixed Signs in a Numeric Vector

View source: R/utils.R

has_mixed_signsR Documentation

Check for Mixed Signs in a Numeric Vector

Description

[Stable]

Determines whether a numeric vector contains both negative and positive values. Zero (0) is treated as neutral and does not count as either sign.

Usage

has_mixed_signs(x)

Arguments

x

(numeric)
a vector to check.

Value

TRUE if the vector contains both positive and negative values, FALSE otherwise.

Examples

# internal functions (not exported) – examples skipped
## Not run: 
has_mixed_signs(1:5)
has_mixed_signs(-(1:5))
has_mixed_signs(c(-1, -2, 3))
has_mixed_signs(c(0, -1))
has_mixed_signs(c(0, 1))
has_mixed_signs(c(0, 1, -1))

## End(Not run)


stratallo documentation built on March 12, 2026, 5:06 p.m.