Dear r-helpers, I am developing a smoothing function that performs a casewise deletion of all the non-informative observations in a bivariate dataset following the Poisson - D'Avril algorythm. But I am now facing two problems: 1)Being based on loops, the function takes a lot of time before having done its work and even if I tried I was not able to vectorize it. 2) I cannot control the degree of smoothing. I have read the posting guide, the FAQ and have also RSiteSearched but without success. Can anybody help me? Here is an example of the procedure: (i have noticed also a different behaviour on different machines) ################################## x <- rnorm(1000, sd=15) y <- -x + rnorm(1000, sd=15) plot(x, y, ann=F, pch=16, xlim=c(-50,50), ylim=c(-50, 50), asp=1, col=2) abline(lm(y ~ x)) metamat<-c( 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0) matemot<-c( 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0) par(cex=.8, pch=15) for(j in seq(-46, 60, 7)){ for (i in -64:58){ points(i+rep(1:8, 8), rep(1:8, each=8)-j, col=metamat) Sys.sleep(0.1) points(i+rep(1:8, 8), rep(1:8, each=8)-j, col="white") Sys.sleep(0.1) points(i+rep(1:8, 8)+1, rep(1:8, each=8)-j, col=matemot) Sys.sleep(0.1) points(i+rep(1:8, 8)+1, rep(1:8, each=8)-j, col="white") } } ################# Thank you, Glucinio