Convert data.frame to xts object

时间:2019-04-16 22:28:32

标签: r

I am trying to convert some data as shown below into xts format. using as.xts I get an error about unambiguous format, but my understanding is my date column is already in the standard format.

 Ex = as.xts(Ex)  

Gives me error Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format

Or

Ex = as.xts(Ex[,-1], Ex[,1]) Error in xts(x, order.by = order.by, frequency = frequency, ...) : order.by requires an appropriate time-based object

Head of my data:

# A tibble: 6 x 3
Date           A     B
<date>     <dbl> <dbl>
1 2013-08-09  10.5  6.40
2 2013-08-12  10.3  6.38
3 2013-08-13  10.5  6.37
4 2013-08-14  10.5  6.40
5 2013-08-15  10.7  6.41
6 2013-08-16  10.6  6.41

0 个答案:

没有答案