sign: Sign Function

Description Usage Arguments Details See Also Examples

Description

sign returns a vector with the signs of the corresponding elements of x (the sign of a real number is 1, 0, or -1 if the number is positive, zero, or negative, respectively).

Note that sign does not operate on complex vectors.

Usage

1
sign(x)

Arguments

x

a numeric vector

Details

This is an internal generic primitive function: methods can be defined for it directly or via the Math group generic.

See Also

abs

Examples

1
2
sign(pi)    # == 1
sign(-2:3)  # -1 -1 0 1 1 1

robertzk/monadicbase documentation built on May 27, 2019, 10:35 a.m.