#is this what you want? x <- c(-10, -5, 0, 5, 10, 15, 20) y <- c(10, 10, 10, -5, -6, -7, 10) data <- data.frame(x, y) subset(data, x>0 & y==min(y))
On Sat, Oct 25, 2008 at 12:33 PM, Martin Ballaschk <[EMAIL PROTECTED]> wrote: > Hi, > > I'm not very experienced with R and struggle with data selection from a long > matrix with two columns. > > I want to cut out the data between x > 0 and min(y). > >> x <- c(-10, -5, 0, 5, 10, 15, 20) >> y <- c(10, 10, 10, -5, -6, -7, 10) >> data <- as.matrix( cbind(x, y) ) > >> data > x y > [1,] -10 10 > [2,] -5 10 > [3,] 0 10 _ > [4,] 5 -5 |-- data interval > [5,] 10 -6 _| to be selected > [6,] 15 -7 > [7,] 20 10 > > > I need that to select the interval between a time 0 and a peak that is the > minimum here to fit that interval via nls() later. > > Can anybody help? I would be very thankful for general hints how to select > data with the help of conditions. > > 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. > -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis ______________________________________________ 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.