inst/tinytest/test_arith.R

r <- rast(matrix(0.5, 2, 2))
expect_equal(as.vector(values(2 - r)), rep(1.5, 4))
expect_equal(as.vector(values(r - 2)), rep(-1.5, 4))
expect_equal(as.vector(values(2 / r)), rep(4, 4))
expect_equal(as.vector(values(r / 2)), rep(0.25, 4))

Try the terra package in your browser

Any scripts or data that you put into this service are public.

terra documentation built on Oct. 13, 2023, 5:08 p.m.