I\'m trying to convert a data frame to xts object using the as.xts()-method. Here is my input dataframe q:
q
t x
1 2006-01-01 00:00:
I defined an index with the length equal to the number of rows of my tibble. Only after defining the time sequence separately as shown with the example:
ti= seq(from = ymd_hm("2000-01-01 00:00"),
to = ymd_hm("2000-01-02 01:00"), by = "30 min", tz = "UTC")
tbl <- tibble(t =ti,
x = 1:length(t))
)
This code worked:
xts.tbl <- xts(tbl[,-1], order.by = ti)
However all data transformed into characters.