sh_round {shide} | R Documentation |
Round Jalali dates to a specific unit of time
Description
-
sh_floor()
takes ajdate
object and rounds it down to the previous unit of time. -
sh_ceiling()
takes ajdate
object and rounds it up to the next unit of time. -
sh_round()
takes ajdate
object and and rounds it up or down, depending on what is closer. For dates which are exactly halfway between two consecutive units, the convention is to round up.
Usage
sh_round(x, unit = NULL, ...)
sh_floor(x, unit = NULL, ...)
sh_ceiling(x, unit = NULL, ...)
Arguments
x |
A vector of |
unit |
A scalar character, containing a date unit or a multiple of a unit.
Valid date units are |
... |
These dots are for future extensions and must be empty. |
Value
A vector of jdate
objects with the same length as x.
See Also
Examples
x <- jdate("1402-12-15")
sh_floor(x, "year")
sh_floor(x, "2 months")
sh_ceiling(x, "year")
sh_round(x, "year")
sh_round(x, "week") == sh_floor(x, "week")
sh_round(x + 1, "week") == sh_ceiling(x, "week")