[R] divide factor in n equal groups?

Jim Lemon jim at bitwrit.com.au
Fri Jun 8 11:06:36 CEST 2012


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



More information about the R-help mailing list