Last data update: 2014.03.03

R: Return Positive Elements of a Numeric Vector
positivesR Documentation

Return Positive Elements of a Numeric Vector

Description

Simply returns the positive (or non-negative) elements of some input vector x. Defined as x[which(x > 0)] or x[which(x >= 0)] depending on include.zero input.

Usage

positives(x, include.zero = FALSE)

Arguments

x

Numeric vector.

include.zero

If TRUE, elements >= 0 are returned; if FALSE, elements > 0 are returned.

Details

NA

Value

Numeric vector.

Note

NA

Author(s)

Dane R. Van Domelen

References

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

See Also

negatives, nonpositives, nonnegatives

Examples

# Generate 10 values from standard normal distribution
x <- rnorm(10)

# Find positive values
positives(x)

Results