Create a factor dissecting the range of a numeric variable into
bins of equal width, (roughly) equal frequency, or at "natural"
cut points. The cut function is used to create the factor.
one of "intervals" for equal-width bins;
"proportions" for equal-count bins;
"natural" for cut points between bins to be determined
by a k-means clustering.
labels
if FALSE, numeric labels will be used for the factor levels;
if NULL, the cut points are used to define labels; otherwise a character
vector of level names.
Value
A factor.
Author(s)
Dan Putler, slightly modified by John Fox jfox@mcmaster.ca
with the original author's permission.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(RcmdrMisc)
Loading required package: car
Loading required package: sandwich
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RcmdrMisc/bin.var.Rd_%03d_medium.png", width=480, height=480)
> ### Name: bin.var
> ### Title: Bin a Numeric Varisible
> ### Aliases: bin.var
> ### Keywords: manip
>
> ### ** Examples
>
> summary(bin.var(rnorm(100), method="prop", labels=letters[1:4]))
a b c d
25 25 25 25
>
>
>
>
>
> dev.off()
null device
1
>