countones function

countones used in apply to count the number of ones in a vector