resolution_t: Determine the Resolution of Time Indices

View source: R/resolution.R

resolution_tR Documentation

Determine the Resolution of Time Indices

Description

resolution_t method determines resolution of time indices.

For time index types other than integer index ("i") and numeric index ("n"), resolution_t returns an object of tdiff class. The following multiples of units can be returned by resolution_t method:

"y" (years):

1, 2, 5, 10, 20, 50, 100, 200, 500, 1000.

"q" (quarters):

1, 2.

"m" (months):

1, 2, 3, 4, 6.

"w" (weeks):

1, 2, 4, 13, 26.

"d" (days):

1, 15 (1st and 16th day of a month).

"h" (hours):

1, 2, 3, 4, 6, 8, 12.

"min" (minutes):

1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30.

"s" (seconds):

1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 and 1, 2, or 5 times negative powers of 10.

Basic resolution (1) for given type is always returned for vectors with 1 or no non-NA value.

An integer value is returned for type "i" (integer index) and a numeric value (possibly NA_real_) for type "n" (numeric index).

Usage

resolution_t(x)

## S3 method for class 'tind'
resolution_t(x)

Arguments

x

an object of tind class or of other time index class supported by tind package.

Value

For all types except for integer index ("i") and numeric index ("n") resolution_t returns an object of tdiff class. An integer value for type "i" (integer index) and a numeric value (possibly NA_real_) for type "n" (numeric index) are returned.

See Also

rounding for rounding time indices to specified resolution, is.regular method for checking if time indices form a regular sequence, tspan method for determining time span of indices.

Examples

(ds <- tind(y = 2024, m = rep(1:3, each = 2), d = c(1, 16)))
resolution_t(ds)
(ms <- tind(y = 2023, m = 1 + 2 * (0:5)))
resolution_t(ms)
(th <- tind(H = 13, M = (0:3) * 15))
resolution_t(th)
(dt <- tind(y = 2025, m = 2, d = 1, H = 13, M = 27, S = (0:5) * 10))
resolution_t(dt)


tind documentation built on Dec. 28, 2025, 1:06 a.m.