[R] Another way to count TRUE

Suharto Anggono Suharto Anggono suharto_anggono at yahoo.com
Wed Jun 7 18:33:53 CEST 2017

To get the number of TRUE in logical vector 'x',
tabulate(x, 1)
can be used. Actually, it gives count of 1, but TRUE as integer is 1. Since R 3.4.0, it gives a correct answer, too, when the count is 2^31 or more.

More information about the R-help mailing list