as.data.table.xts | R Documentation |
Efficient conversion xts to data.table.
## S3 method for class 'xts'
as.data.table(x, keep.rownames = TRUE, key=NULL, ...)
x |
xts to convert to data.table |
keep.rownames |
Default is |
key |
Character vector of one or more column names which is passed to |
... |
ignored, just for consistency with |
as.xts.data.table
if (requireNamespace("xts", quietly = TRUE)) {
data(sample_matrix, package = "xts")
sample.xts <- xts::as.xts(sample_matrix) # xts might not be attached on search path
# print head of xts
print(head(sample.xts))
# print data.table
print(as.data.table(sample.xts))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.