Hello everyone in the forum For introducing myself I would say I have a basic knowledge of R. Now I am intended to implement a flood algorithm using R. I have some MatLab experience doing these, and as an example to explain more or less what I want, I have a m code to calculate the slope from a Digital elevation model:
slope=zeros(row,col); for i=2:row-1 for j=2:col-1 dzdx=(raster(i,j+1)-raster(i,j-1))/(2*res); dzdy=(raster(i+1,j)-raster(i-1,j))/(2*res); slope(i,j)=sqrt(dzdx^2+dzdy^2); end end; The question is to know how to do the similar procedure on R. All suggestions are welcome Thanks All best, Jorge PD:I am using R on windows system 64 bits -- View this message in context: http://r.789695.n4.nabble.com/Raster-manipulation-in-R-tp4127768p4127768.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.