ordering: ordering

Description Usage Arguments Details Value References See Also Examples

View source: R/ordering.R

Description

Determining the ordering (montonicity) of a vector

Usage

1
2
3
ordering(x, na.rm = TRUE)

monotonicity(x, na.rm = TRUE)

Arguments

x

numeric vector

na.rm

logical; whether to omit NA values. (Default: TRUE)

Details

monotonicty determines the ordering/sorting of a vector, one of:

ordering tests, e.g. is_increasing are more efficient at testing for specific cases.

monotonicity() is an alias for ordering.

Value

integer;

References

http://en.wikipedia.org/wiki/Monotonic_function http://stackoverflow.com/questions/13093912/how-to-check-if-a-sequence-of-numbers-is-monotonically-increasing-or-decreasing

See Also

Examples

1
2
3
4
5
6
7
8
9
  ordering( 1:3 )      # 2  
  ordering( c(1,1,3) ) # 1 
  ordering( c(1,0,1) ) # 0  "No ordering, does not apply constant"
  ordering( c(3,1,1) ) # -1
  ordering( 3:1 )      # -2
  
  ordering(letters)        # 2 
  ordering( rev(letters) ) # -2 
  

decisionpatterns/ordering documentation built on May 5, 2019, 7:09 a.m.