Thank you very much. I am trying to execute it line by line to get some understanding how this works. Could you please explain me what these two lines do?
tie <- m[,2] == c(-Inf, m[-nrow(m),2]) m <- m[ !tie, ] I would like to thank you in advance for your help Best Regards Alex ________________________________ From: Michael Bedward <michael.bedw...@gmail.com> Cc: Rhelp <r-help@r-project.org> Sent: Wed, September 15, 2010 12:52:45 PM Subject: Re: [R] Interpolate? a line Hello Alex, Here is one way to do it. It works but it's not pretty :) interp <- approx(c(2, 62), c(3, 34), method="linear", xout=2:62) m <- matrix(c(interp$x, round(interp$y)), ncol=2) tie <- m[,2] == c(-Inf, m[-nrow(m),2]) m <- m[ !tie, ] You might want to examine the result like this... plot(m) # plots points lines(c(2,26), c(3, 34)) # overlay line for comparison Michael [[alternative HTML version deleted]] ______________________________________________ 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.