What I am doing is trying to determine where the dates are not
sequential (difference is not one day). Everytime that this occurs,
the expression 'diff(.days) != 1' is TRUE and this is where a new
sequence starts. 'diff' will return a vector one shorter than its
input; I am assuming that the firs
Congratulations!
Could you explain to me the reason you add an initial "TRUE" value in the
cumulatice sum?
jholtman wrote:
>
> Will this work:
>
>> x <- read.table(textConnection(" day user_id
> + 2008/11/012001
> + 2008/11/012002
> + 2008/11/012003
> + 2008/11/0120
Will this work:
> x <- read.table(textConnection(" day user_id
+ 2008/11/012001
+ 2008/11/012002
+ 2008/11/012003
+ 2008/11/012004
+ 2008/11/012005
+ 2008/11/022001
+ 2008/11/022005
+ 2008/11/032001
+ 2008/11/032003
+ 2008/11/032004
+ 2008/11/03
...if that is possible
My task is to find the longest streak of continuous days a user participated
in a game.
Instead of writing an sql function, I chose to use the R's rle function, to
get the longest streaks and then update my db table with the results.
The (attached) dataframe is somethin
4 matches
Mail list logo