[R] Decile

Phil Spector spector at stat.berkeley.edu
Thu Jun 17 01:22:21 CEST 2010


Arturo -
     Something like

cut(x,quantile(x,(0:10)/10),labels=FALSE,include.lowest=TRUE)

should give you what you want.

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu


On Wed, 16 Jun 2010, J. Arturo Coral Alamo wrote:

> Hello comunity,
>
> I'm trying to find a similar function as decile of SPSS, NTILES (10)
> some of you know about  that, I will appreciate your help in advance.
>
> In SPSS
> VARIABLES=Sales  (A) /NTILES (10) /PRINT=NO
>
> for example if I have Next data input:
>
> case IdCust Sales Profit 1 265 140.81 314.31 2 266 1778.96 408.32 3 267
> 2663.66 820.85 4 268 2994.14 913.73 5 269 2185.58 686.64 6 271 105.21 18.94
>
>
> Output must be:
>
> case IdCust Sales Profit Ntil-Sales Ntil-Profi 1 265 140.81 314.31 2 2 2 266
> 1778.96 408.32 4 4 3 267 2663.66 820.85 8 8 4 268 2994.14 913.73 10 10 5 269
> 2185.58 686.64 6 6 6 271 105.21 18.94 1 1
>
>
>
>
> Best regards,
> -----------------------------------------------
> Arturo Coral Alamo
> Business Researcher Team
> SOLUCION ESTRATEGICA Inc.
> Genera competitividad en tu empresa
> M?vil: (+511) 988 567 000
> Fijo:   (+511) 528 50 44
> www.seincperu.com
>
> 	[[alternative HTML version deleted]]
>
>



More information about the R-help mailing list