Learn R Programming

normalizeH (version 1.0.0)

how.many: How many elements are TRUE in a logical vector

Description

This function finds number of elements which are TRUE in a logical vector

Usage

how.many(x)

Value

A non-negative integer of length 1.

Arguments

x

A logical vector

Author

Baidya Nath Mandal <mandal.stat@gmail.com>

Examples

Run this code
x <- c(1,-1,1,-1,1,-1)
how.many(x == -1)
how.many(seq(1,7,2) == 3)

Run the code above in your browser using DataLab