tformat {xts} | R 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
indexFormat(x)
indexFormat(x) <- value
Arguments
x |
An xts object. |
... |
Arguments passed to other methods. |
value |
New index format string (see |
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
be formatted according to its tclass()
(e.g. Date, POSIXct, timeDate,
yearmon, etc.).
The 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)