Description Usage Arguments Details Value Note See Also Examples
Tests vectors for (strictly) increasing, decreasing, monotonic and constant properties
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | is_constant(x, na.rm = TRUE)
is_increasing(x, na.rm = TRUE)
is_strictly_increasing(x, na.rm = na.omit)
is_decreasing(x, na.rm = na.omit)
is_strictly_decreasing(x, na.rm = na.omit)
is_incremental(x, step = 1, na.rm = TRUE)
is_uniform(x, step = NULL, na.rm = TRUE)
is_monotonic(x, na.rm = TRUE)
is_strictly_monotonic(x, na.rm = TRUE)
is_sorted(x, na.rm = TRUE)
is_strictly_sorted(x, na.rm = TRUE)
is_unsorted(...)
is_strictly_unsorted(...)
|
x |
vector |
na.rm |
function or NULL; action to perform on input to handle the missing values |
step |
integer; step size for |
... |
used for passing default arguments |
Tests to various monotone properties of vectors.
is_incremental
determines if x is incremental, i.e. monotonic and equally
spaced.
is_uniform
is a wrapper around is_incremental
with step=1
is_[strictly_]monotonic
determine the sort properties of x
.
This differes from base::is.unsorted()
which should more properly be called
is.increasing
since base::is.unsorted(3:1) == TRUE
; 3:1
is obviously
sorted.
is_sorted()
is a alias for is_monotonic()
and is_strictly_sorted()
is
an alias for is_strictly_monotonic()
.
logical or NA. (NB: NA is returned because it is a logical vector and this is needed to put these results cleanly in tables.)
logical
The behavior of this package is The functions base::is.unsorted()
is perhaps misnamed and should properly be
names is_not_increasing
since base::is.unsorted(3:1) == TRUE
after all
vector 3,2,1 is sorted but not increasing.
base::diff()
base::is.unsorted()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
is_constant( rep(3,5) )
is_increasing( 1:5 ) # TRUE
is_increasing( c(1,2,1,3) ) # FALSE
is_increasing( c(1,NA,2,3) ) # NA
is_increasing( c(1,NA,2,3), na.omit ) # TRUE
is_monotonic( 1:5 ) # TRUE
is_monotonic( -5:5 ) # TRUE
is_monotonic( 5:-5 ) # TRUE
is_monotonic( c(1,5,3)) # FALSE
is_incremental(1:5 )
is_incremental( c(1,2,5))
is_incremental(1:5, step=NULL)
is_uniform(1:5)
is_monotonic( 1:3 )
is_strictly_monotonic(1:3)
is_monotonic( c(1,3,2) )
is_strictly_monotonic( c(1,3,2) )
is_sorted(1:3)
is_sorted(c(1,3,2))
lets <- letters[1:3]
is_monotonic( lets )
is_monotonic( c('a', 'c', 'b') )
is_sorted(1:10)
is_sorted(-5:5)
is_sorted(5:-5)
is_sorted( letters )
is_sorted( rev(letters) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.