Re: [R] Problem with cut

From: jim holtman <jholtman_at_gmail.com>
Date: Fri, 22 Feb 2008 19:00:32 -0500

You can also get more detail on where the intervals are with 'dig.lab':

> cc <- cut(vv, 12, dig.lab=6)
> str(cc)

 Factor w/ 12 levels "(149.804,166.17]",..: 1 1 1 1 1 2 2 2 2 3 ...
> cc

 [1] (149.804,166.17] (149.804,166.17] (149.804,166.17] (149.804,166.17] (149.804,166.17]
 [6] (166.17,182.536] (166.17,182.536] (166.17,182.536] (166.17,182.536] (182.536,198.902]
[11] (182.536,198.902] (182.536,198.902] (182.536,198.902] (198.902,215.268] (198.902,215.268]
[16] (198.902,215.268] (198.902,215.268] (215.268,231.634] (215.268,231.634] (215.268,231.634]

[21] (215.268,231.634] (231.634,248]     (231.634,248]
(231.634,248]     (231.634,248]
[26] (248,264.366]     (248,264.366]     (248,264.366]
(248,264.366]     (264.366,280.732]

[31] (264.366,280.732] (264.366,280.732] (264.366,280.732] (280.732,297.098] (280.732,297.098]
[36] (280.732,297.098] (280.732,297.098] (297.098,313.464] (297.098,313.464] (297.098,313.464]
[41] (297.098,313.464] (313.464,329.83] (313.464,329.83] (313.464,329.83] (313.464,329.83]
[46] (329.83,346.196] (329.83,346.196] (329.83,346.196] (329.83,346.196] (329.83,346.196]
12 Levels: (149.804,166.17] (166.17,182.536] (182.536,198.902] (198.902,215.268] ... (329.83,346.196]
>

On Fri, Feb 22, 2008 at 10:59 AM, Henrique Dallazuanna <wwwhsd_at_gmail.com> wrote:
> Is to show the categorys which contains '330'
>
> On 22/02/2008, Heinz Tuechler <tuechler_at_gmx.at> wrote:
> > At 15:22 22.02.2008, Henrique Dallazuanna wrote:
> > >Try this:
> > >
> > >grep("330", levels(cc), value=T)
> >
> >
> > Could you please explain in a little more detail,
> > how this answers the original question?
> >
> > "I would have expected 330 to fall into (313,330] category.
> > Can you please advice what do I do wrong?"
> >
> >
> > Thank you
> >
> >
> > Heinz
>
> >
> >
> >
> > >On 22/02/2008, Jussi.Lehto_at_ubs.com <Jussi.Lehto_at_ubs.com> wrote:
> > > > Hi All,
> > > >
> > > > I might misunderstood how cut works. But following behaviour surprises
> > > > me.
> > > >
> > > > vv <- seq(150, 346, by= 4)
> > > > cc <- cut(vv, 12)
> > > > cc[vv == 330]
> > > > Results [1] (330,346]
> > > >
> > > > I would have expected 330 to fall into (313,330] category.
> > > >
> > > > Can you please advice what do I do wrong?
> > > >
> > > > Many Thanks,
> > > > Jussi Lehto
> > > >
> > > > Visit our website at http://www.ubs.com
> > > >
> > > > This message contains confidential information and is in...{{dropped:29}}
> > > >
> > > >
> > > > ______________________________________________
> > > > 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.
> > > >
> > > >
> > >
> > >
> > >--
> > >Henrique Dallazuanna
> > >Curitiba-Paraná-Brasil
> > >25° 25' 40" S 49° 16' 22" O
> > >
> > >______________________________________________
> > >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.
> >
> >
> >
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>
> ______________________________________________
> 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
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.
Received on Sat 23 Feb 2008 - 00:03:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 23 Feb 2008 - 01:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive