Learn R Programming

rray (version 0.0.0.9000)

rray_sign: Sign function

Description

Compute the elementwise sign of an array. Depending on the input the following is returned:

  • 1: Positive input

  • 0: Zero input

  • -1: Negative input

  • NA: NA input

Usage

rray_sign(x)

Arguments

x

A vector, matrix, array or rray.

Value

An array the same shape as x, but with numeric values indicating the sign of the values in x.

See Also

Other math functions: remainder, rray_abs, rray_clip, rray_maximum, rray_multiply_add

Examples

Run this code
# NOT RUN {
rray_sign(-5)

x <- rray(c(5, NA, -5), c(3, 2))

rray_sign(x)

# }

Run the code above in your browser using DataLab