get_interval: Get the interval of a datetime variable

View source: R/get_interval.R

get_intervalR Documentation

Get the interval of a datetime variable

Description

The interval is the highest datetime unit that can explain all instances of a variable of class Date, class POSIXct, or class POSIXct. This function will determine what the interval of the variable is.

Usage

get_interval(x)

Arguments

x

A variable of class of class Date or of class POSIXt.

Details

See vignette("padr") for more information on intervals.

Value

A character string indicating the interval of x.

Examples

x_month <- seq(as.Date('2016-01-01'), as.Date('2016-05-01'), by = 'month')
get_interval(x_month)

x_sec <- seq(as.POSIXct('2016-01-01 00:00:00'), length.out = 100, by = 'sec')
get_interval(x_sec)
get_interval(x_sec[seq(0, length(x_sec), by = 5)])

padr documentation built on Nov. 23, 2022, 5:06 p.m.