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
    })
)
   

Try the RStoolbox package in your browser

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

RStoolbox documentation built on May 29, 2024, 6:34 a.m.