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?
Thanks John 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) www.stat.missouri.edu -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Ballaschk Sent: Saturday, October 25, 2008 7:52 PM To: r-help@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 sequence >> 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 for me. Will have a look into it tomorrow ... Thanks! Cheers Martin ______________________________________________ R-help@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. ______________________________________________ R-help@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.