Are the points you are looking for (those data points with no other data points above or to the right of them) a subset of the convex hull of the data points? If so, chull(x,y) can quickly give you the points on the convex hull (typically a fairly small number) and you can look through them for the ones you want.
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of tonja.krue...@web.de > Sent: Wednesday, October 10, 2012 3:16 AM > To: r-help@r-project.org > Subject: [R] own function: computing time > > Hi all, > > I wrote a function that actually does what I want it to do, but it tends to > be very slow for > large amount of data. On my computer it takes 5.37 seconds for 16000 data > points and > 21.95 seconds for 32000 data points. As my real data consists of 18000000 > data points it > would take ages to use the function as it is now. > Could someone help me to speed up the calculation? > > Thank you, Tonja > > system.time({ > x <- runif(32000) > y <- runif(32000) > > xy <- cbind(x,y) > > outer <- function(z){ > !any(x > z[1] & y > z[2])} > j <- apply(xy,1, outer) > > plot(x,y) > points(x[j],y[j],col="green") > > }) > > ______________________________________________ > 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.