ti_type: Get Time Index Type

View source: R/types.R

ti_typeR Documentation

Get Time Index Type

Description

ti_type method returns time index type as a character value, either in short form (single letter, code used internally) or long form (name).

is.instant returns TRUE for continuous time indices representing points in time (date-time, time of day, and numeric indices) and FALSE for time discrete indices that represent periods of time, for example, days representing (usually) 24 hours, weeks, months, quarter, and years (as well as integer indices).

Usage

ti_type(x, long = TRUE, valid = FALSE)

## S3 method for class 'tind'
ti_type(x, long = TRUE, valid = FALSE)

## S3 method for class 'Date'
ti_type(x, long = TRUE, valid = FALSE)

## S3 method for class 'POSIXt'
ti_type(x, long = TRUE, valid = FALSE)

is.instant(x)

Arguments

x

an object of tind class or an object coercible to it.

long

a logical value, if FALSE, internal single-character code of index type is returned; if TRUE, long (human-readable) name is returned (TRUE by default).

valid

a logical value, if TRUE, syntactically valid names will be returned (FALSE by default).

Value

A character value for ti_type, a logical value for is.instant.

Note

Behaviour of is.instant differs from that of identically named function in lubridate package, which returns TRUE for all time classes including dates.

See Also

t_unit.

Examples

ti_type(as.tind(1999))
ti_type(as.tind(1999), FALSE)
ti_type(as.tind("2001q3"))
ti_type(as.tind("2001q3"), FALSE)
ti_type(as.tind("2003-11"))
ti_type(as.tind("2003-11"), FALSE)
ti_type(as.tind("2004-W53"))
ti_type(as.tind("2004-W53"), FALSE)
ti_type(as.tind("2020-02-29"))
ti_type(as.tind("2020-02-29"), FALSE)
ti_type(today())
ti_type(today(), FALSE)
is.instant(today())
ti_type(now())
ti_type(now(), FALSE)
is.instant(now())
ti_type(Sys.Date())
ti_type(Sys.Date(), FALSE)
is.instant(Sys.Date())
ti_type(Sys.time())
ti_type(Sys.time(), FALSE)
is.instant(Sys.time())


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