Skip to content

Determining a basal correct count

2 messages · David Herzberg, Phil Spector

#
David -
    I *think*

   apply(x,1,function(x)rle(x[which(x==1)[1]:length(x)])$lengths[1])

gives you what you want, but without a reproducible example it's 
hard to say.  It will fail if there are no 1s in a given row.

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu
On Thu, 28 Oct 2010, David Herzberg wrote: