# NOT RUN {
x <- sqrt(1:100)
mat <- matrix(x, 10, 10)
r1 <- rast(nrows=10, ncols=10, xmin=0, vals = x)
r2 <- rast(nrows=10, ncols=10, xmin=0, vals = mat)
all.equal(r1, r2)
all.equal(r1, r1*1)
all.equal(rast(r1), rast(r2))
# compare geometries
compareGeom(r1, r2)
# Compare all cell values for near equality
# as floating point number imprecision can be a problem
m <- minmax(r1 - r2)
all(abs(m) < 1e-7)
# comparison of cell values to create new SpatRaster
e <- r1 == r2
# }
Run the code above in your browser using DataLab