Learn R Programming

SciencesPo (version 1.3.9)

freq: Simple Frequency Table

Description

Creates a simple frequency data.frame.

Usage

freq(x, weighs = NULL, breaks = graphics::hist(x, plot = FALSE)$breaks,
  digits = 3, include.lowest = TRUE, order = c("desc", "asc", "level",
  "name"), useNA = c("no", "ifany", "always"), ...)

## S3 method for class 'default': freq(x, weighs = NULL, breaks = graphics::hist(x, plot = FALSE)$breaks, digits = 3, include.lowest = TRUE, order = c("desc", "asc", "level", "name"), useNA = c("no", "ifany", "always"), ...)

Arguments

x
A vector of values for which the frequency is desired.
weighs
A vector of weights.
breaks
one of: 1) a vector giving the breakpoints between histogram cells; 2) a function to compute the vector of breakpoints; 3) a single number giving the number of cells for the histogram; 4) a character string naming an algorithm to compute the number of ce
digits
The number of significant digits required.
include.lowest
Logical; if TRUE, an x[i] equal to the breaks value will be included in the first (or last) category or bin.
order
The order method.
useNA
Logical; if TRUE NA's values are included.
...
Additional arguements (currently ignored)

See Also

Frequency, crosstable.

Examples

Run this code
data(Presidents)

freq(Presidents$winner.party)

Run the code above in your browser using DataLab