[R] Simple question on binning data

Frank E Harrell Jr f.harrell at Vanderbilt.Edu
Thu May 13 23:54:17 CEST 2010


On 05/13/2010 04:05 PM, Bert Gunter wrote:
> ?hist
>
> However, I'm going to go way out on a limb here, as I know absolutely
> nothing of what you're up to, and suggest that you do NOT need to bin your
> data.
>
> -- Bert

Bert is correct.  Binning is seldom needed and usually distorts.  It is 
the statistical equivalent of a former governor from Alaska.

Frank

>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
>
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of Erik Iverson
> Sent: Thursday, May 13, 2010 1:51 PM
> To: george5000
> Cc: r-help at r-project.org
> Subject: Re: [R] Simple question on binning data
>
> There would be several people who could help if you gave us a minimal,
> reproducible example like the posting guide asks for.
>
> If you have a vector of continuous data, and need to create a
> categorical variable (in R, a factor) from that continuous variable,
> then ?cut can help you.
>
>
>
> george5000 wrote:
>> Hello everyone,
>>
>> I have a data set, and I need to bin my data using a bin width of say
> g(n).
>> Would anyone be willing to tell me how to do this in R?
>>
>> Thanks
>


-- 
Frank E Harrell Jr   Professor and Chairman        School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list