tformat: Get or Replace the Format of an xts Object's Index

tformatR Documentation

Get or Replace the Format of an xts Object's Index

Description

Generic functions to get or replace the format that determines how an xts object's index is printed.

Usage

tformat(x, ...)
tformat(x) <- value

## S3 method for class 'xts'
tformat(x, ...)
## S3 replacement method for class 'xts'
tformat(x) <- value

##### The functions below are DEPRECATED #####
indexFormat(x)
indexFormat(x) <- value

Arguments

x

an xts object

value

new index format string (see Details for valid values)

...

arguments passed to other methods

Details

Valid values for the value argument are the same as specified in the Details section of strptime.

An xts object's tformat is NULL by default, so the index will be formatted according to its tclass (e.g. Date, POSIXct, timeDate, yearmon, etc.).

tformat only changes how the index is printed and how the row names are formatted when xts objects are converted to other classes (e.g. matrix or data.frame. It does not affect the internal index in any way.

Value

A vector containing the format for the object's index.

Note

Both indexFormat and indexFormat<- are deprecated in favor of tformat and tformat<-, respectively.

Author(s)

Jeffrey A. Ryan

See Also

index has more information on the xts index, tclass details how xts handles the class of the index, tzone has more information about the index timezone settings.

Examples

  x <- timeBasedSeq('2010-01-01/2010-01-02 12:00')
  x <- xts(seq_along(x), x)

  # set a custom index format
  head(x)
  tformat(x) <- "%Y-%b-%d %H:%M:%OS3"
  head(x)

joshuaulrich/xts documentation built on March 9, 2024, 2:50 a.m.