[R] [FORGED] Re: merging-binning data
Rolf Turner
r.turner at auckland.ac.nz
Thu Nov 5 22:29:51 CET 2015
On 05/11/15 22:49, Alaios wrote:
> Thanks.That is what I want. It is more that I do not know how to read
> factors that these two functions return
>
> Browse[1]> y
> $`13.6954016405008`
> [1] (13.2,115]
> Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]
>
> $`88.5092280867206`
> [1] (13.2,115]
> Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]
>
> $`137.931810364616`
> [1] (115,217]
> Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]
>
> str(y)
> List of 30
> $ 13.6954016405008: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
> $ 88.5092280867206: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
> $ 137.931810364616: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
> $ 138.559590072838: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
> $ 143.085897171535: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
> $ 177.678839068735: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
> $ 177.819693807561: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
> $ 184.752000138622: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
> $ 211.255591076421: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
> $ 238.951618624679: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
> $ 241.609050762905: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
> $ 252.528297510773: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3 3 3
> $ 254.643586371518: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
>
> I need to be able to keep the items within their groups and at the same
> time to keep the label of the group so to be able to use it for plotting
> purposes.
>
> How I can do that?
(1) I am afraid that I have no idea what you're asking. It seems to me
that you need to learn how to "do R".
(2) I'm puzzled by your "str(y)" output given above. If the "y" in
question is that from the commands that I sent you, then it should be a
list with *5* entries, not 30!
Note that y is a *list* of 5 vectors, the first of which consists of all
those entries of your original data vector that lie between 13.2 and
115, the second of which consists of all those entries of your original
data vector that lie between 115 and 217, and so on.
It doesn't seem very complicated to me. What is it that you don't
understand?
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-help
mailing list