Apply method to Positive and Negative number | R Documentation |
Apply method to Positive and Negative number.
negative(x,method = "min")
positive(x,method = "min")
positive.negative(x,method = "min")
x |
A numerical vector with data. |
method |
Accept 3 values. "min", "max", "min.max". |
These functions apply the chosen method to the chosen subset (negative, positive, or both) from the vector and return the result.
negative: apply the chosen method to every negative number of the input vector. positive: apply the chosen method to every positive number of the input vector. positive.negative: apply the chosen method to every negative and positive number of the input vector.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
nth, colnth, rownth,sort_unique, Round
x <- rnorm(1000)
identical(negative(x,"min"), min(x<0))
identical(positive(x,"min"), min(x>0))
identical(positive.negative(x,"min"), c(min(x<0),min(x>0)))
x<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.