[R] Deciles and R

Nuno Soares ndsoares at mail.telepac.pt
Thu Apr 21 17:06:32 CEST 2005


Hi everyone,

I'm a new R user (if this is a really basic question, please do excuse
me...) and I'm having some questions regarding a deciles problem.

I have a variable which I need to categorize according to its deciles (X).
However, this categorization should be made into another variable (call it
NewVar).

Ex. for the quartiles case (just for the sake of exposition, since I need
deciles...), I would like to be able to generate the NewVar variable based
on the quantiles of X:

	X		NewVar
	1		1
	6		2
	2		1
	4		2
	3		1
	5		2
	12		4
	9		3
	8		3
	10		4
	11		4
	7		3

Is there a function or a way of doing this automatically? I've searched the
help files but found no solution to this problem...

Regards,

Nuno




More information about the R-help mailing list