Martin Maechler
ETH Zurich
> Best wishes,
> Matthias
> Von: Bert Gunter
> Gesendet: Dienstag, 14. März 2017 21:34
> An: matthias-gon...@gmx.de
> Cc: r-help@r-project.org
> Betreff: Re: [R] Quantiles with ordered categories
> Inline.
You could round the quantiles of the codes of the ordered factor to
come up with a reasonable result. E.g.,
quantile.ordered <- function(x, ...)
ordered(levels(x)[as.integer(quantile(as.integer(x), ...))],
levels=levels(x))
> unCut <- log2(2:30)
> Cut <- cut(unCut, breaks=0:6, ordered_result=TRU
with ordered categories
Inline.
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Mar 14, 2017 at 12:36 PM, wrote:
> Dear
Inline.
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Mar 14, 2017 at 12:36 PM, wrote:
> Dear R users,
>
> This works:
>
> quantile(1:10, probs=0.5)
>
>
Dear R users,
This works:
quantile(1:10, probs=0.5)
This fails (obviously):
quantile(factor(1:10), probs=0.5)
But why do quantiles for ordered factors not work either?
quantile(ordered(1:10), probs=0.5)
Is it because interpolation (see the optional type argument) is not defined? Is
there a
5 matches
Mail list logo