tformat | R Documentation |
Generic functions to get or replace the format that determines how an xts object's index is printed.
tformat(x, ...)
tformat(x) <- value
indexFormat(x)
indexFormat(x) <- value
x |
An xts object. |
... |
Arguments passed to other methods. |
value |
New index format string (see |
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.
A vector containing the format for the object's index.
Both indexFormat()
and indexFormat<-
are deprecated in
favor of tformat()
and tformat<-
, respectively.
Jeffrey A. Ryan
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.