Skip to contents

Whether or not a vector is a diverges a value, returns a logical. Used to help default a scale_color for ggplot2.

Usage

is_diverging(x, mid_pt = 0)

Arguments

x

A vector to check the divergence of.

mid_pt

A single number checking divergence from. Defaults to 0.

Value

Logical, whether or not x is a diverges mid_pt.

Examples

library(cheem)

is_diverging(-10:10)
#> [1] TRUE
is_diverging(-10:-5)
#> [1] FALSE
is_diverging(mtcars$mpg, 25)
#> [1] TRUE
is_diverging(mtcars$mpg, 40)
#> [1] FALSE