Smoothing a 2D matrix with rollmean, filter, rollapply or other R facilities by moving average sliding window method
问题 I am trying to find a function in R which smooths a 2D matrix which is already padded by zero around the matrix depending on the length of the window. If the window size is 3 then we pas 3 zeros from the top, bottom, right and left and then we do the averaging to smooth it. I found rollmean in SO and other tutorials but it doesn't exactly do what I want. I need (say if the window size is 3) we consider a window of 3*3 and take the average and replace it by the current elements of the current