[R] Create subsets of data

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon May 9 21:14:11 CEST 2011


Hi,

On Mon, May 9, 2011 at 9:40 AM, Pavan G <pavan.namd at gmail.com> wrote:
> Hello All,
> Let's say I have points on a x-y plane. x ranges from 0-2 and y from 0-2.
> There are points in quadrants x[0:1]---y[0:1] and in x[1:2]----y[1:2]. I
> would like to get the mean and std of the points in the x[0:1]----y[0:1]
> quadrant alone. Is there a straight forward way to do it?
>
> I asked a similar question a few days ago regarding plotting a subset of
> data using conditions. The solution was:
> http://r.789695.n4.nabble.com/Conditional-plot-length-in-R-td3503855.html

The solution to this question will also be similar, I guess ... you
should take some time to figure out how indexing with (different types
of) vectors works:

http://cran.r-project.org/doc/manuals/R-intro.html#Index-vectors

If your question doesn't have to do with selecting the appropriate
elements of your data, are you asking how to take a "mean" or std.dev
of the subset of points you know how to select? It's not clear what
you mean by "mean" ... do you want the average value of x vs. avg.
value of y ... or do you want the "centroid" of a set of points in
each quadrant, or ... what?

> Thank you,
> Why-so-serious.

A curious choice for a valediction ...

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the R-help mailing list