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.