[R] quantcut
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Nov 3 15:23:16 CET 2008
On Mon, 3 Nov 2008, Kåre Edvardsen wrote:
> I'm trying to devide x into tertiles, but ends up with integer limits
> even x holds one decimal. The analysis is extremely sensitive to the
Do you mean integer character representations in the labels? See ?cut and
argument 'dig.lab'. What you actually got was the 3 significant digits
(rather than integers) which you asked for. (*In the labels*, not the
actual values used.)
> limits and I like to keep them right. How can that be done?
>
> quartiles <- quantcut( x[x >= 0], q=seq(0,1, by=(1/3))
>> table(quartiles)
> quartiles
> [180,344] (344,448] (448,644]
> 16467 16476 16452
>
>
> [[alternative HTML version deleted]]
Please do follow the posting guide and save us this message.
>
> ______________________________________________
> R-help at 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list