## get a test data.frame
dat <- grasslandData[grasslandData$Site == c("AZ") &
grasslandData$Species %in% c("Bouteloua rothrockii") &
grasslandData$Quad == "SG4",]
inv <- grasslandInventory[["SG4"]]
outDat <- assign(
dat = dat,
inv = inv,
dorm = 1,
buff = .05,
buffGenet = 0.005,
clonal = TRUE
)
## test that the area of each individual is not larger than the area of the
# bounding box
test_that("individual area is not larger than the quadrat area", {
apply(
X = outDat,
MARGIN = 1,
FUN = function(x)
expect_lte(
object = x$Area,
expected =
sf::st_bbox(outDat)["xmax"] * sf::st_bbox(outDat)["ymax"]
)
)
})
## test that the output data has the required column names
test_that("output data has required column names", {
expect_equal(object = sum(
c(
"Species",
"Site",
"Quad",
"Year",
"trackID",
"age",
"size_tplus1",
"recruit",
"survives_tplus1",
"basalArea_genet",
"basalArea_ramet",
"geometry",
"nearEdge"
) %in% names(outDat)
),
expected = 13)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.