Learn R Programming

plotrix (version 2.1-5)

integer.frequency: Calculate frequencies of a vector of integers

Description

Calculates the frequencies of integers in a vector.

Usage

integer.frequency(x,bins)

Arguments

x
a vector of integers.
bins
The values to count in x. These values may be a subset or superset of the actual values included in x.

Value

  • A vector of counts.

Details

integer.frequency counts the number of values in x that are equal to each of the values in bins. If there are values in bins that are not in x, the count for that bin will be zero, and if values in x are not included in bins, they will be ignored. It will not handle NAs correctly. However, it is only meant to be called by freq.

See Also

freq

Examples

Run this code
testvec<-c(sample(1:10,100,TRUE),rep(12,5))
 # leave out the 10 bin and stick in an 11 bin which will be empty
 integer.frequency(testvec,c(1:9,11,12))

Run the code above in your browser using DataLab