countones: countones used in apply to count the number of ones in a...

View source: R/rutils.R

countonesR Documentation

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

Description

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

Usage

countones(invect)

Arguments

invect

vector of values

Value

A single value of zero or the number of ones

Examples

## Not run: 
  set.seed(12346)
  x <- trunc(runif(10)*10)
  x
  countones(x)  # should be 2

## End(Not run)

haddonm/codeutils documentation built on April 15, 2024, 1:02 p.m.