R: A simple wrapper of 'lubridate::ceiling_date()'

ceiling_index {tibbletime} | R Documentation

## A simple wrapper of `lubridate::ceiling_date()`

### Description

This is a thin wrapper around a `lubridate::ceiling_date()` that works for `hms`, `yearmon`, and `yearqtr` classes as well.

### Usage

    ceiling_index(x, unit = "seconds")

### Arguments

`x` | a vector of date-time objects
`unit` | a character string specifying a time unit or a multiple of a unit to be rounded to. Valid base units are `second`, `minute`, `hour`, `day`, `week`, `month`, `bimonth`, `quarter`, `season`, `halfyear` and `year`. Arbitrary unique English abbreviations as in the `period()` constructor are allowed. Rounding to multiples of units (except weeks) is supported.

### See Also

`lubridate::ceiling_date()`

### Examples

    data(FB)
    dplyr::mutate(FB, date2 = ceiling_index(date, "year"))

    time_test <- create_series('00:00:00'~'12:00:00',
                               '1 minute', class = "hms")

    dplyr::mutate(time_test, date2 = ceiling_index(date, "hour"))

[Package tibbletime version 0.1.6 Index]