binData | R Documentation |
Bins each variable in data
in bins
Bins. It can return a data frame (out="data.frame"
), a table with the counts (out="table"
), or
a table converted to a data frame with an additional variable Freq
. The values can be either the bin mids (val="mids"
) or
the bin numbers (val="interval"
). If possible all variables contain an attribute breaks
with breaks used.
binData( data, bins, out = c("data.frame", "table", "binned"), val = c("mid", "interval"), pretty = TRUE, numeric = TRUE )
data |
object: a data.frame or object that can be converted to a data frame with variables to bin |
bins |
integer: number of bins, will be recycled if necessary |
out |
character: output type, either |
val |
character: values for outer, eiter |
pretty |
logical: should be base::pretty used or minimum and maximum (default: |
numeric |
logical: return output a |
a data frame or table with the results
df <- data.frame(x=runif(25), y=runif(25)) binData(df, 5, 'data.frame') binData(df, 5, 'table') binData(df, 5, 'binned')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.