inst/tinytest/test_multivariate.R

f <- system.file("ex/logo.tif", package = "terra")
r <- rast(f)
km <- k_means(r, centers=5)
r[1] <- NA
km <- k_means(r, centers=5)
km <- k_means(r, centers=5, maxcell=10)

x <- rast(system.file("ex/logo.tif", package="terra"))   
a <- layerCor(x, "cor")
b <- layerCor(x, cor)
expect_equivalent(a$correlation, b)

Try the terra package in your browser

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

terra documentation built on May 29, 2024, 12:33 p.m.