[R] How do I sign off this server

Fresen, John fresenj at missouri.edu
Mon Oct 27 04:42:12 CET 2008

I signed onto this R-help server.  It's wonderful but I'm getting tooooo
many e-mails all mixed up with other important e-mails.  I can't cope
with it all.  
How do I sign off?



John L. Fresen, PhD 
Department of Statistics, 134N Middlebush Hall
University of Missouri-Columbia, 65211, MO, US
(573) 882-9660 (phone)   (573) 884-5524 (fax)
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Martin Ballaschk
Sent: Saturday, October 25, 2008 7:52 PM
To: r-help at r-project.org
Subject: Re: [R] help: selection of data

Hi Jim.

jim holtman schrieb:
> If you only want the first sequence, 

Yes, that's true, I forgot to say that!

>> x <- c(-10, -5, 0, 5, 10, 15, 20)
>> y <- c(10, 10, 10, -5, -6, -7, 10)
>> data <- as.matrix( cbind(x, y) )
>> # if you only want the first 'run', then use 'rle' to find it
>> mask <- data[,1] > 0 & data[,2] > min(data[,2])
>> run <- rle(mask)
>> # now either the first or second will be TRUE, so find it
>> offset <- cumsum(c(1, run$lengths))  # off set of the start of
>> index <- if (run$values[1]) 1 else 2
>> new_data <- data[seq(from=offset[index], length=run$lengths[index]),]

Although I'm far from understanding that -- it seems to work very well
me. Will have a look into it tomorrow ...



R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list