Thanks Frederic.
that solved the problem.
Thanks again.
Cameron
--
View this message in context:
http://r.789695.n4.nabble.com/help-on-timeseries-tp3076866p3095633.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org
Hi:
This is more or less the same idea as the other respondent, but uses
function rle() instead. The function:
findDates <- function(df) {
u <- rle(df$Signals)
n <- length(u$values)
ends <- with(u, cumsum(lengths)[values == -1])
begins <- with(u, cumsum(lengths)[values == 1]
riginal Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of cameron
Sent: 07 December 2010 17:42
To: r-help@r-project.org
Subject: [R] help on timeseries
i have time series of momentum signal. I want to get the date of each of the
"-1" s
i have time series of momentum signal. I want to get the date of each of the
"-1" signal period. for example , the first period of -1 signal begins on
2005-9-21 and ends on 2005-9-28. 2nd period of -1 signal begins on
2005-09-30 and ends on 2005-10-28.
Thx
Cameron
datePx
4 matches
Mail list logo