[R] R

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon Feb 20 02:23:17 CET 2012


Hi,

On Sun, Feb 19, 2012 at 7:47 PM,  <elliot.welch at virgin.net> wrote:
> Hello, just a couple of short questions that would be much appreciated.
>
> Is there a way of putting a vectors inputs in size order from low to high?

See: ?order, ?sort

> And if I had a random list or TRUE and FALSE, is there a way of finding the 100th TRUE?

Let's make this more tractable -- say I want to find the 3rd TRUE in:

x <- c(TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE)

Then:

which(cumsum(x) == 3)
## [1] 7

HTH,

-steve

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