[R] quntile(table)?

Seung Jun seungwjun at gmail.com
Tue Aug 28 16:22:48 CEST 2007


Hi,

I have data in the following form:

  index  count
    -7      32
     1    9382
     2    2192
     7     190
    11     201

I'd like to get quantiles from the data.  I thought about something like this:

  index <- c(-7, 1, 2, 7, 11)
  count <- c(32,  9382, 2192, 190, 201)
  quantile(rep(index, count))

It answers correctly, but I feel it's wasteful especially when count
is generally large.  So, my question is, is there a way to get
quantiles directly from this table (without coding at a low level)?

Thanks,
Seung



More information about the R-help mailing list