Checks whether a vector or list is sortable. This is the condition for a
vector to be usable as time column in a sftime
object.
Arguments
- x
The object to check.
Value
TRUE
if x
passes the check, else FALSE
.
Details
Checks whether the provided object can be handled by
order
. A couple of basic types are whitelisted. However, custom
types can be defined when they provide a dedicated generic to xtfrm.
Note that a list
can only be sorted with atomic values. See the
examples below for a template.
Examples
x <- Sys.time() + 5:1 * 3600 * 24
sort(x)
#> [1] "2025-02-25 19:23:50 UTC" "2025-02-26 19:23:50 UTC"
#> [3] "2025-02-27 19:23:50 UTC" "2025-02-28 19:23:50 UTC"
#> [5] "2025-03-01 19:23:50 UTC"
is_sortable(x)
#> [1] TRUE