Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

freq

Calculate 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,decr.order=TRUE)

Arguments

x

a vector, matrix or data frame.

variable.labels

optional labels for the variables. The default is the name 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.

decr.order

Whether to order each frequency table in decreasing order.

Details

freq calls table to get the frequency counts and builds a list with one or more components containing the value labels and counts.

Value

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

Note

The limit on the number of bins has been removed, so passing a numeric vector with many levels may produce a huge, useless "frequency" table.

Author(s)

Jim Lemon

See Also

Examples

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

prettyR

Pretty Descriptive Stats

v2.2-3
GPL (>= 2)
Authors
Jim Lemon <drjimlemon@gmail.com>, Philippe Grosjean <phgrosjean@sciviews.org>
Initial release
2019-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.