I need to merge two time series, and it seems it's best to do it using merge.zoo. When I try to convert each of the two data frames to zoo, I get the following error:
zoo(FNCC_short)
Error in as.matrix.data.frame(x) :
dims [product 10] do not match the length of object [19]
Where did R find length of 19? I have:
> class(FNCC_short)
[1] "data.frame"
> length(FNCC_short)
[1] 2
> length(FNCC_short[,1])
[1] 10
> length(FNCC_short[,2])
[1] 10
I could not use read.zoo(...)
to get the data because the csv time fields are not in the right format - I had to read the csv file first, then fix the time format.
Here is the FNCC_short:
> FNCC_short
time_FNCC FNCC
1 2013-02-07 09:00:00 2.556
2 2013-02-07 09:01:00 2.556
3 2013-02-07 09:02:00 2.552
4 2013-02-07 09:03:00 2.552
5 2013-02-07 09:04:00 2.552
6 2013-02-07 09:05:00 2.552
7 2013-02-07 09:06:00 2.552
8 2013-02-07 09:07:00 2.539
9 2013-02-07 09:08:00 2.539
10 2013-02-07 09:09:00 2.539
> class(FNCC_short$time_FNCC)
[1] "POSIXlt" "POSIXt"
So, the first column it POSIX time. Why doesn't this simple conversion work?