powered by
For SpatRasters x and y, atan2(y, x) returns the angle in radians for the tangent y/x, handling the case when x is zero. See Trig
Trig
See Math-methods for other trigonometric and mathematical functions that can be used with SpatRasters.
Math-methods
# S4 method for SpatRaster,SpatRaster atan2(y, x)
SpatRaster
# NOT RUN { r1 <- rast(nrow=10, ncol=10) r2 <- rast(nrow=10, ncol=10) values(r1) <- (runif(ncell(r1))-0.5) * 10 values(r2) <- (runif(ncell(r1))-0.5) * 10 atan2(r1, r2) # }
Run the code above in your browser using DataLab