tests/testthat/test-entropy.R

context("Entropy")

data()

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

test_that("entropyCpp is correct",
        expect_equal(rasterEntropy(), {x <- calc(, 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 March 18, 2022, 5:37 p.m.