Q:

consecutive number of events without NA

How can I extract the number of consecutive events without an empty event, from a vector? 
I've tried rle() but it doesn't give me what I am looking for. 
With this type of data
data=c(NA,NA,seq(1,4,0.5),NA,0,0,NA,NA,NA,NA,runif(10,-5,10),NA)

I want to be able to know the length of the different sequence of events without a NA.  For this case the output should be: 7, 2 and 10.  
I also need the positions of each sequence of events. 

A:

rle works here:
data=c(NA,NA,seq(1,4,0.5),NA,0,0,NA,NA,NA,NA,runif(10,-5,10),NA)
with(rle(!is.na(data)),lengths[values])
## [1]  7  2 10

You can get lengths and positions like this:
with(rle(!is.na(data)),cbind(length=lengths[values],position=cumsum(c(1,lengths))[values]))
##      length position
## [1,]      7        3
## [2,]      2       11
## [3,]     10       17

