Combining the length() and which() commands gives a handy method of counting elements that meet particular criteria.

`b <- c(7, 2, 4, 3, -1, -2, 3, 3, 6, 8, 12, 7, 3) `

`b`

Let’s count the 3s in the vector b. [Read more…] about R Is Not So Hard! A Tutorial, Part 15: Counting Elements in a Data Set