Re: [R] Help me replace a for loop with an "apply" function

2009-10-01 Thread gd047
(.days){ > + .diff <- cumsum(c(TRUE, diff(.days) != 1)) > + max(table(.diff)) > + }) >> contig > 2001 2002 2003 2004 2005 >41224 >> >> > > > On Thu, Oct 1, 2009 at 11:29 AM, gd047 wrote: >> >> ...if that is

[R] Help me replace a for loop with an "apply" function

2009-10-01 Thread gd047
...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