Convert data.frame to xts object and save types

Is there a way to create an xts object from data.frame and save the data type? My numbers are converted to a character. Since 2009, this publication assumes merging columns into existing xts: http://r.789695.n4.nabble.com/as-xts-convert-all-my-numeric-data-to-character-td975564.html

It is unclear whether this is ONLY a means to do this. It seems to be hacked and bulky for large data frames. I would think that finished xts would respect data types.

+5
source share
2 answers

No, you can’t. Xts / zoo objects are a matrix with an index attribute, and you cannot mix types in a matrix.

xts-data.frame, xts . data.frames , .

+6

, , . , .

.

data < - xts ( [, 2: 6], order.by = $time, unique = FALSE, tzone = "")

( $time - POSIXct, . )

+1

All Articles