[R-SIG-Finance] Financial time series data mining in R
Patrick Burns
patrick at burns-stat.com
Thu May 21 20:29:44 CEST 2009
I think you are looking for something
like:
lapply(z, rle)
assuming 'z' is a data frame.
Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")
Reena Bansal wrote:
> Hi All,
>
> This is a financial time series data mining question. Suppose I have a
> time series as below, a typical fetch with NA's and prices.
>
>> z
> y
> 1 NA
> 2 NA
> 3 884.96
> 4 894.07
> 5 902.33
> 6 810.36
> 7 810.52
> 8 811.94
> 9 812.12
> 10 826.85
> 11 826.45
> 12 808.03
> 13 800.28
> 14 800.70
> 15 800.68
> 16 NA
> 17 NA
> 18 800.49
> 19 800.65
> 20 801.82
>
> I want to create summary of the data, which should give me the length of
> each contiguous block of NA and NUMBER(prices here), and start and end
> index, so a sample output might be.
>
> Type Length StartIndex EndIndex
> NA 2 1 2
> NUMBER 13 3 15
> NA 2 16 17
> NUMBER 3 18 20
>
> I looked into arules package but didn't find anything that did the same.
> Any ideas?
>
> Thanks everybody,
> Reena
>
>
>
> [[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.
>
>
More information about the R-SIG-Finance
mailing list