tests/testthat/test-entropy.R

context("Entropy")

entro <- function(x){
    p <- table(x)/length(x)
    -sum(p*log(p))
}

test_that("entropyCpp is correct",
    expect_equal(rasterEntropy(), {
        x <- app(, entro)
        names(x)<-"entropy";
        x
    })
)
   
bleutner/RStoolbox documentation built on April 23, 2024, 9:36 a.m.