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
                                         spec...@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]]



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to