binnedCounts | R Documentation |
Bins a numeric variable, as for a histogram, and reports the count and percentage in each bin. The computations are done by the hist
function, but no histogram is drawn. If supplied a numeric matrix or data frame, the distribution of each column is printed.
binnedCounts(x, breaks="Sturges", round.percents=2,
name=deparse(substitute(x)))
x |
a numeric vector, matrix, or data frame. |
breaks |
specification of the breaks between bins, to be passed to the |
round.percents |
number of decimal places to round percentages; default is |
name |
name for the variable; only used for vector argument |
For a numeric vector, invisibly returns the vector of counts, named with the end-points of the corresponding bins. For a matrix or data frame, invisibly returns NULL
John Fox jfox@mcmaster.ca
hist
, discreteCounts
with(Prestige, binnedCounts(income))
binnedCounts(Prestige[, 1:4])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.