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

discreteCounts

Frequency Distributions of Numeric Variables


Description

Computes the frequency and percentage distribution of a descrete numeric variable or the distributions of the variables in a numeric matrix or data frame.

Usage

discreteCounts(x, round.percents=2, name=deparse(substitute(x)),
  max.values=min(round(2*sqrt(length(x))), round(10*log10(length(x))), 100))

Arguments

x

a discrete numeric vector, matrix, or data frame.

round.percents

number of decimal places to round percentages; default is 2.

name

name for the variable; only used for vector argument x.

max.values

maximum number of unique values (default is the smallest of twice the square root of the number of elements in x, 10 times the log10 of the number of elements, and 100); if exceeded, an error is reported.

Value

For a numeric vector, invisibly returns the table of counts. For a matrix or data frame, invisibly returns NULL

Author(s)

See Also

Examples

set.seed(12345) # for reproducibility
discreteCounts(data.frame(x=rpois(51, 2), y=rpois(51, 10)))

RcmdrMisc

R Commander Miscellaneous Functions

v2.7-1
GPL (>= 2)
Authors
John Fox [aut, cre], Robert Muenchen [ctb], Dan Putler [ctb]
Initial release
2020-08-12

We don't support your browser anymore

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