x<-rnorm(100) MyLevels<-quantile(x,probs=c(0,.5,1)) MyLevels
0% 50% 100% -2.11978442 -0.03770613 2.00186397
next i want to replace each x[i] in x by 1,2,3 or 4 depending on which quantile that x[i] falls. How do I do that in a "vector" fashion?
Take a look at the "cut" function.
-- Ross Ihaka Email: [EMAIL PROTECTED] Department of Statistics Phone: (64-9) 373-7599 x 85054 University of Auckland Fax: (64-9) 373-7018 Private Bag 92019, Auckland New Zealand
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help