[R] Conditional plot length in R

From: Pavan G <pavan.namd_at_gmail.com>
Date: Fri, 06 May 2011 14:28:44 -0400


Hello All,
Let's say I have data spanning all quadrants of x-y plane. If I plot data with a certain x and y range using xlim and ylim or by using plot.formula as described in this link:
http://www.mathkb.com/Uwe/Forum.aspx/statistics/5684/plotting-in-R

*DF <- data.frame(x = rnorm(1000), y = rnorm(1000))

*

*> str(DF)*

*'data.frame': 1000 obs. of 2 variables: $ x: num -0.0265 0.1554 -0.1050 -0.9697 -0.3430 ... $ y: num 1.386 -1.356 -1.170 0.426 0.204 ...

Now, let's plot the data meeting the criteria you indicated above:

 plot(y ~ x, data = DF, subset = (x > 0) & (y > 0))*

How then can I get the length of that data? If have 1000 data points and 200 lie in x,y>0, how do I find that the length is 200? Thanks!
Why-so-serious

        [[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 Fri 06 May 2011 - 18:30:59 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Fri 06 May 2011 - 18:40:05 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