Re: [R] Quantiles of data in a contingency table

From: Unung Istopo Hartanto <unung_at_enciety.com>
Date: Thu 17 Mar 2005 - 20:10:20 EST

Try.

median(rep(data$size, data$count))

thanks,

regards,

On Thu, 2005-03-17 at 14:42, Matt Mohebbi wrote:
> Hello,
>
> I have data of the following form:
>
> > data <- data.frame(type=c("c","d","e"), size=c(10,20,30), count=c(20,10,5))
> > data
> type size count
> 1 c 10 20
> 2 d 20 10
> 3 e 30 5
>
> I would like to compute the quantiles of size given the counts. For
> instance, in this example, the median size would be 10. Is there an
> easy way of doing this?
>
> Is there a good way to deal with data in this format in general? Much
> of R seems to center around having an entry for each item. This
> question (http://www.r-project.org/nocvs/mail/r-help/2000/0102.html)
> seems to be related but no one provided an answer.
>
> Thanks,
> Matt
>

-- 
Unung Istopo Hartanto <unung@enciety.com>
ENCIETY Business Consult

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Mar 17 20:10:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:50 EST