| freqtable | R Documentation | 
Generate frequency tables for one or more variables in a data frame or a survey design.
freqtable(.data, ...)
## Default S3 method:
freqtable(.data, ..., na.rm = FALSE, weights = NULL)
## S3 method for class 'survey.design'
freqtable(.data, ..., na.rm = FALSE, weights = TRUE)
| .data | a data frame or 'survey.design' object | 
| ... | one or more expressions accepted by  | 
| na.rm | Whether to remove missing values in the variables. | 
| weights | If '.data' is a data frame, an optional expression selecting a weighting variable. If '.data' is a survey design, either 'TRUE' (the default) to to use survey weights, or 'FALSE' or 'NULL' to return unweighted frequencies. | 
The result is an array of class 'table'.
freq, wtd.table,
xtabs, table.
data(hdv2003)
freqtable(hdv2003, nivetud, sport)
freqtable(hdv2003, nivetud, sport, sexe)
freqtable(hdv2003, nivetud, sport, weights=poids)
freqtable(hdv2003, starts_with("trav"))
# Using survey design objects
library(survey)
hdv2003_wtd <- svydesign(ids=~1, weights=~poids, data=hdv2003)
freqtable(hdv2003_wtd, nivetud, sport)
# Compute percentages based on frequencies
hdv2003 |> freqtable(sport) |> freq()
hdv2003 |> freqtable(sport, sexe) |> prop()
hdv2003 |> freqtable(sport, sexe) |> cprop()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.