hour_nearest: Compute the nearest integer hour of day at supplied times

View source: R/time_categories.R

hour_nearestR Documentation

Compute the nearest integer hour of day at supplied times

Description

Compute the nearest integer hour of day from a DateTimeClasses object (i.e., nearest neighbour interpolation).

Usage

hour_nearest(time)

Arguments

time

A vector of times, of the class DateTimeClasses.

Value

The function returns an integer for each inputted time.

Author(s)

Edward Lavender

Examples


hour_nearest(as.POSIXct("2016-01-01 13:01:40"))
hour_nearest(as.POSIXct(c("2016-01-01 13:30:00")))
hour_nearest(as.POSIXct(c("2016-01-01 13:30:01")))
hour_nearest(as.POSIXct(c("2016-01-01 13:01:40", NA)))


edwardlavender/Tools4ETS documentation built on Nov. 29, 2022, 7:41 a.m.