Quantcast
Channel: Active questions tagged xts - Stack Overflow
Viewing all articles
Browse latest Browse all 57

Converting a data frame to xts

$
0
0

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:00  1  2  2006-01-01 01:00:00  2  3  2006-01-01 02:00:00  3str(q)'data.frame':   10 obs. of  2 variables: $ t: POSIXct, format: "2006-01-01 00:00:00""2006-01-01 01:00:00""2006-01-01 02:00:00""2006-01-01 03:00:00" ...   $ x: int  1 2 3 4 5 6 7 8 9 10

The result is:

> as.xts(q)Error in as.POSIXlt.character(x, tz, ...) :   character string is not in a standard unambiguous format

This is the simplest example I can think of, so it's quite frustrating not getting it to work... Any help is appreciated!


Viewing all articles
Browse latest Browse all 57

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>