A <- matrix(c( 1,1,1,1,0,1,1,1,1, 1,1,1,0,1,0,1,0,0, 1,0,1,0,0,1,0,0,0, 1,1,0,0,0,0,1,0,0), 4, 9, byrow=TRUE)
apply(A, 1, function(x) sum(diff(x)==1)) ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
