Learn R Programming

tind (version 0.2.4)

ti_type: 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 tind ti_type(x, long = TRUE, valid = FALSE)

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

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

is.instant(x)

Value

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

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).

See Also

t_unit.

Examples

Run this code
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())

Run the code above in your browser using DataLab