freq {plotrix}R Documentation

Produce a frequency table

Description

Calculates one or more frequency table(s) from a vector, matrix or data frame.

Usage

 freq(x,variable.labels=NULL,display.na=TRUE,bin.range=NULL,include.empty=FALSE)

Arguments

x a vector, matrix or data frame.
variable.labels optional labels for the variables. The default is the names of the variable passed or the names attribute if the variable has more than 1 dimension.
display.na logical - whether to display counts of NAs.
bin.range minimum and maximum of the desired range of integer values. Ignored if x is not numeric.
include.empty logical - whether to display empty bins.

Details

freq calls integer.frequency if x is numeric, otherwise table to get the frequency counts and builds a list with one or more components containing the value labels and counts. Note that a limit on the number of bins has been removed, so passing a numeric vector with many levels may produce a huge, useless "frequency" table.

Value

A list with one or more components. Each component includes the values of the relevant variable as the names.

Author(s)

Jim Lemon

See Also

print.freq, integer.frequency

Examples

 test.df<-data.frame(A=sample(1:10,130,TRUE),C=sample(LETTERS[1:14],130,TRUE))
 freq(test.df)

[Package plotrix version 2.0.2 Index]