sh_round {shide}R Documentation

Round Jalali dates to a specific unit of time

Description

Usage

sh_round(x, unit = NULL, ...)

sh_floor(x, unit = NULL, ...)

sh_ceiling(x, unit = NULL, ...)

Arguments

x

A vector of jdate objects.

unit

A scalar character, containing a date unit or a multiple of a unit. Valid date units are "day", "week", "month", "quarter" and "year". These can optionally be followed by "s". If multiple of a unit is used, unit coefficient must be a whole number greater than or equal to 1. If NULL, defaults to "day".

...

These dots are for future extensions and must be empty.

Value

A vector of jdate objects with the same length as x.

See Also

lubridate::round_date()

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")

[Package shide version 0.2.1 Index]