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

	[[alternative HTML version deleted]]

