[R] divide factor in n equal groups?

Jim Lemon
Fri, 08 Jun 2012 09:06:36 -0000

On 06/08/2012 12:43 AM, David Studer wrote:
> Could anyone please tell me what is the most elegant
> way to divide an ordinal variable in equal groups? (as
> cut() does with continous variables)
>
> for example I'd like to have the factor "educational level"
> in three groups "low" "medium" and "high"

Hi David,
Sounds like

quantile(educational_level,probs=seq(0,1,length.out=3))

to me.

Jim