Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04d5e86
commit 0aa0607
Showing
4 changed files
with
48 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
a15b58fdd7f7dc1782cf3b8576fd06e6 *DESCRIPTION | ||
08c858ef5eef2949d6cdf60d11802305 *DESCRIPTION | ||
817d6a403e94463dd4df5afba9ebc71b *NAMESPACE | ||
045ed726fdced75a5c89be1dba9cfefe *R/DarkDiv.R | ||
d1e63cd5cf99f1fbef10a6342fbd53c0 *R/utility_functions.R | ||
d4bbed99767212586a534d0e94d708b2 *R/utility_functions.R | ||
74f12839f852716c0b3b28c10148c4d8 *man/DarkDiv.Rd | ||
70f2dc536da264419a13c1c3e28f2926 *tests/testthat.R | ||
446ee71fe36d37609acaf68961eced81 *tests/testthat/testthat.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
library(testthat) | ||
library(DarkDiv) | ||
|
||
test_that("Beals gives same results as vegan", { | ||
require(vegan) | ||
data(dune) | ||
BealsDD <- DarkDiv(x = dune, method = "RawBeals") | ||
BealsVegan <- vegan::beals(x = dune, type = 0, include=F) | ||
expect_equal(BealsDD$AllProbs, BealsVegan) | ||
}) | ||
|
||
test_that("Using indication matrix directly yields same results as reference", { | ||
require(vegan) | ||
data(dune) | ||
#RawBeals | ||
ddBeals <- DarkDiv(x = dune, method = "RawBeals") | ||
ddBeals2 <- DarkDiv(x = dune, r = ddBeals$indication, method = "RawBeals") | ||
expect_equal(ddBeals, ddBeals2) | ||
#Favorability | ||
ddFav <- DarkDiv(x = dune, method = "Favorability") | ||
ddFav2 <- DarkDiv(x = dune, r = ddFav$indication, method = "Favorability") | ||
expect_equal(ddFav, ddFav2) | ||
#Hypergeometric | ||
ddHyp <- DarkDiv(x = dune, method = "Hypergeometric") | ||
ddHyp2 <- DarkDiv(x = dune, r = ddHyp$indication, method = "Hypergeometric") | ||
expect_equal(ddHyp, ddHyp2) | ||
}) | ||
|
||
test_that("When removeAbsent = F, names of species and sites are unchanged, even if some species are removed", { | ||
require(vegan) | ||
data(dune) | ||
dune2 <- dune | ||
dune2[ , 2] <- rep(0, nrow(dune2)) | ||
#RawBeals | ||
ddHypFull <- DarkDiv(x = dune, method = "Hypergeometric") | ||
ddHypPart <- DarkDiv(x = dune2, method = "Hypergeometric", removeAbsent = F) | ||
expect_equal(dimnames(ddHypFull$AllProbs), dimnames(ddHypPart$Pool)) | ||
}) | ||
|
||
library(testthat) | ||
library(DarkDiv) | ||
|
||
test_that("Beals gives same results as vegan", { | ||
require(vegan) | ||
data(dune) | ||
BealsDD <- DarkDiv(x = dune, method = "RawBeals") | ||
BealsVegan <- vegan::beals(x = dune, type = 0, include=F) | ||
expect_equal(BealsDD$AllProbs, BealsVegan) | ||
}) | ||
|
||
test_that("Using indication matrix directly yields same results as reference", { | ||
require(vegan) | ||
data(dune) | ||
#RawBeals | ||
ddBeals <- DarkDiv(x = dune, method = "RawBeals") | ||
ddBeals2 <- DarkDiv(x = dune, r = ddBeals$indication, method = "RawBeals") | ||
expect_equal(ddBeals, ddBeals2) | ||
#Favorability | ||
ddFav <- DarkDiv(x = dune, method = "Favorability") | ||
ddFav2 <- DarkDiv(x = dune, r = ddFav$indication, method = "Favorability") | ||
expect_equal(ddFav, ddFav2) | ||
#Hypergeometric | ||
ddHyp <- DarkDiv(x = dune, method = "Hypergeometric") | ||
ddHyp2 <- DarkDiv(x = dune, r = ddHyp$indication, method = "Hypergeometric") | ||
expect_equal(ddHyp, ddHyp2) | ||
}) | ||
|
||
test_that("When removeAbsent = F, names of species and sites are unchanged, even if some species are removed", { | ||
require(vegan) | ||
data(dune) | ||
dune2 <- dune | ||
dune2[ , 2] <- rep(0, nrow(dune2)) | ||
#RawBeals | ||
ddHypFull <- DarkDiv(x = dune, method = "Hypergeometric") | ||
ddHypPart <- DarkDiv(x = dune2, method = "Hypergeometric", removeAbsent = F) | ||
expect_equal(dimnames(ddHypFull$AllProbs), dimnames(ddHypPart$Pool)) | ||
}) | ||
|