I have the following vectors pattern in R:

A vector of zeroes and ones (Binary vectors , each with length of 4), for example:

```
x <- c(1,0,1,1)

```

I would like to find number of consecutive 1(s) (from left to right, that is very important)

**Edit:**   

How to do it for matrix, at which each vector has the pattern mentioned above.  

Preferably with base functions (and without any Rcpp like solutions)

Any pretty solution without \*apply functions?