[R] count data with a specific range

Joris Meys jorismeys at gmail.com
Thu Jun 24 03:12:30 CEST 2010


see ?cut

Cheers
Joris

On Thu, Jun 24, 2010 at 2:57 AM, Yi <liuyi.feier at gmail.com> wrote:
> I would like to prepare the data for barplot. But I only have the data frame
> now.
>
> x1=rnorm(10,mean=2)
> x2=rnorm(20,mean=-1)
> x3=rnorm(15,mean=3)
> data=data.frame(x1,x2,x3)
>
> If there a way to put data within a specific range? The expected result is
> as follows:
>  range       x1                  x2                    x3
> -10-0        2                      5                     1  (# points in
> this range)
> 0-10         7                     9                      6
> ...
>
> I know the table function but I do not know how to deal with the range
> issue.
>
> Thanks in advance.
>
> Yi
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



More information about the R-help mailing list