R: Return Non-Negative Elements of a Numeric Vector
nonnegatives
R Documentation
Return Non-Negative Elements of a Numeric Vector
Description
Simply returns the non-negative elements of some input vector x. Defined as x[which(x >= 0)].
Usage
nonnegatives(x)
Arguments
x
Numeric vector.
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
positives, negatives, nonpositives
Examples
# Generate 10 values from standard normal distribution
x <- rnorm(10)
# Find non-negative values
nonnegatives(x)