r - Iterating through equal time intervals in data frame -


so have data frame looks this:

> sample                           userid time_intervals freq 00008bb4da272a962c275faa085d66d2     2009-01-01    0 00008bb4da272a962c275faa085d66d2     2009-02-01    0 00008bb4da272a962c275faa085d66d2     2009-03-01    0 00008bb4da272a962c275faa085d66d2     2009-04-01    0 00008bb4da272a962c275faa085d66d2     2009-05-01   13 00008bb4da272a962c275faa085d66d2     2009-06-01    0 00008bb4da272a962c275faa085d66d2     2009-07-01    4 

dput accessible here: https://gist.github.com/anonymous/d4ccfed8e315e3bc7f3233a7e55512f9

it frequency table divided 35 periods of 1 month (the same users). in other words, every 35 rows, userid shows new value, , time_intervals starts on again 2009-01-01.

now, i'm having trouble figuring out how following (i have little experience data frames): need find out number of consistently active users (where freq > 0 in months) across periods of 12 months, starting 2009-01-01 , moving 1 month further @ each step. need users have no time_interval freq = 0 within entire period of 12 consecutive months in order able use them in analyses.

i have same data in cross tabs format (don't know 1 more appropriate work with):

> head(freq_user_month)                                   time_intervals userid                             2009-01-01 2009-02-01 2009-03-01 2009-04-01 2009-05-01   00008bb4da272a962c275faa085d66d2          0          0          0          0          0   0000bc16c8cd37af06a426da70817b67          0          0          0          0          0   0000e06e07496624211632e8e264126c          0          0          0          0          0   0001093b22d1ea8b6615eaf63245347b          0          0          0          0          0   00010cd7a9e5b6eb882e136f5cd7b4a7          0          0          0          0          0   00018d018ebf46845eb72194ebb342fc          0          0          0          0          0 

i hope explanation clear enough. on how begin appreciated.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -