[R] count data with a specific range

From: Yi <liuyi.feier_at_gmail.com>
Date: Wed, 23 Jun 2010 17:57:27 -0700


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. Received on Thu 24 Jun 2010 - 01:00:25 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 Thu 24 Jun 2010 - 01:20:34 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