Re: [R] table questions

From: Patrizio Frederic <frederic.patrizio_at_gmail.com>
Date: Tue, 29 Jul 2008 20:18:39 +0200

# is that what you want?

table(cut(xy,seq(0,max(xy)+.4,by=.4)))

# or this

table(cut(xy,hist(xy)$breaks)) # not the same

regards,

PF

+-------------------------------------------------
| Patrizio Frederic
| Research associate in Statistics,
| Department of Economics,
| University of Modena and Reggio Emilia,
| Via Berengario 51,
| 41100 Modena, Italy
|
| tel:  +39 059 205 6727

| fax: +39 059 205 6947
| mail: patrizio.frederic_at_unimore.it
+-------------------------------------------------



2008/7/29 Edna Bell <edna.bell01_at_gmail.com>:
> Hi again!
>
>
> Suppose I have the following:
>
>> xy <- round(rexp(20),1)
>> xy
> [1] 0.1 3.4 1.6 0.4 1.0 1.4 0.2 0.3 1.6 0.2 0.0 0.1 0.1 1.0 2.0 0.9
> 2.5 0.1 1.5 0.4
>> table(xy)
> xy
> 0 0.1 0.2 0.3 0.4 0.9 1 1.4 1.5 1.6 2 2.5 3.4
> 1 4 2 1 2 1 2 1 1 2 1 1 1
>>
> Is there a way to set things up to have
> 0 - 0.4 0.5 - 0.9 etc. please?
>
> I know there is the cut functions, but breaks are required. If you
> don't have breaks, what should you do, please?
>
> Would using the breaks from the hist function work appropriately, please?
>

> thanks
> Edna Bell
>
> ______________________________________________
> R-help@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.
>



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 Tue 29 Jul 2008 - 18:39:52 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 Wed 30 Jul 2008 - 01:33:09 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