[r] How to count TRUE values in a logical vector