[R] break a vector into classes

Sean Davis sdavis2 at mail.nih.gov
Mon Mar 6 15:27:35 CET 2006


Would a combination of cut() and range() and possibly seq() do what you
need?

Sean


On 3/6/06 9:06 AM, "wouter at paramo.be" <wouter at paramo.be> wrote:

> 
> Hi,
> 
> I'm looking for a function which divides a vector into n classes and
> returns the breaks as well as the number of values in each class.
> 
> This is actually what hist(vector, breaks=n) does, but in hist() n is a
> suggestion only, and is a suggestion only and cannot be enforced (as
> far as I know...)
> 
> It is not so difficult to do it yourself, but a ready made function would
> be nice...
> 
> cheers
> wouter
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list