I'm new to R, trying to apply an equation found in an article to three raster images I have. I understand the equation but don't know how to apply it in R. I've attached a screenshot of the equation. The equation is how to take three raster images and calculate the horizontal net gradient difference between them.
Φ1, Φ2, Φ3 are the three raster images, and del H (upside down triangle, can't figure out how to write the symbol here) is the horizontal gradient component.
I'm familiar with basic raster operations in R. However I don't know how to calculate the horizontal gradient of a raster, or find the net gradient difference.
How might this be done?