[R-SIG-Finance] time series aggregating error message
Joshua Ulrich
josh.m.ulrich at gmail.com
Mon May 10 17:00:12 CEST 2010
Have you looked at ?to.period in xts? If so, why didn't that work for you?
--
Joshua Ulrich
FOSS Trading: www.fosstrading.com
On Mon, May 10, 2010 at 9:50 AM, mam3xs <mam3xs at gmail.com> wrote:
> Hi all,
>
> I am tring to aggregate intra-day data to daily basis data, (data sample
> attached at the end of email.)
>
> test <- read.table("D:\\test.csv", header=F, sep=",")
>
> test.ep <- test[1:304231,]
>
> tt <- as.Date(test.ep[,1], "%m/%d/%y" )
>
> rn <- test.ep[,7]
>
> test.rn <- as.xts(rn,tt)
>
> nodudate = tt[!duplicated(tt)]
>
> test.sum = aggregate(test.rn, nodudate, sum)
>
> The error message said, "Error: length(time(x)) == length(by[[1]]) is not
> TRUE"
>
>
> Appreciate for any hints.
>
> Cheers
> mam
>
>
>
> 01/03/05 31.8 31.8 31.78 31.8 167600 0.009479 01/03/05 31.8 31.8 31.78
> 31.8 4500 0 01/03/05 31.75 31.75 31.6 31.67 11800 -0.0041 01/03/05 31.62
> 31.63 31.6 31.6 9200 -0.00221 01/03/05 31.61 31.67 31.6 31.67 20300
> 0.002213 01/04/05 31.69 31.71 31.67 31.71 29800 0.001262 01/04/05 31.7
> 31.74 31.64 31.64 34800 -0.00221 01/04/05 31.64 31.66 31.63 31.63 35000
> -0.00032 01/04/05 31.64 31.66 31.63 31.66 41600 0.000948 01/05/05 31.65
> 31.65 31.64 31.64 17000 -0.00063 01/05/05 31.61 31.61 31.6 31.6 16600
> -0.00127 01/05/05 31.6 31.61 31.6 31.6 6600 0 01/05/05 31.61 31.61 31.57
> 31.59 20500 -0.00032 01/05/05 31.6 31.67 31.59 31.63 12800 0.001265
> 01/06/05 31.64 31.67 31.64 31.66 5800 0.000948 01/06/05 31.64 31.66 31.64
> 31.66 71700 0 01/06/05 31.66 31.66 31.64 31.65 7300 -0.00032
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>
More information about the R-SIG-Finance
mailing list