From: David Winsemius <dwinsemius_at_comcast.net>

Date: Fri, 06 May 2011 14:34:56 -0400

Date: Fri, 06 May 2011 14:34:56 -0400

On May 6, 2011, at 2:28 PM, Pavan G wrote:

> 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?
*

with(DF, sum((x > 0) & (y > 0), na.rm=TRUE) ) # since it is 1 for TRUE and 0 for false after coercion.

-- David Winsemius, MD West Hartford, CT ______________________________________________ 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:39:21 GMT

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

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 - 19:20:06 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.
*