Q:

Rolling average using groupby and varying window length

I'm trying to create a rolling average of a column based on an ID column and a measurement time label in R, but I am having a lot of trouble with it. 
Here is what my dataframe looks like:
ID Measurement Value

A    1           10

A    2           12

A    3           14

B    1           10

B    2           12

B   3           14

B   4           10

The problem is that I have measurement counts varying from 9 to 76 for each ID so I haven't found a solution that will create a column of a rolling average for each ID while handling the varying window length. 
My goal is a dataframe like this: 
ID Measurement Value Average

A    1           10 NA

A    2           12 11

A    3           14 12

B    1           10 NA

B    2           12 11

B   3           14  12 

B   4           10 11.5 

A:

This uses no packages. It calculates the cumulative average by ID except that for Measurement equal to 1 it forces the average to be NA.
transform(DF, Avg = ave(Value, ID, FUN = cumsum) / 
   ifelse(Measurement == 1, NA, Measurement))

giving:
  ID Measurement Value  Avg
1  A           1    10   NA
2  A           2    12 11.0
3  A           3    14 12.0
4  B           1    10   NA
5  B           2    12 11.0
6  B           3    14 12.0
7  B           4    10 11.5

Note
The input DF in reproducible form is:
Lines <- "ID Measurement Value
A    1           10
A    2           12
A    3           14
B    1           10
B    2           12
B    3           14
B    4           10"
DF <- read.table(text = Lines, header = TRUE, strip.white = TRUE, as.is = TRUE)

