context("CCPred Class")
test_that("objects of class CCPred are constructed correctly", {
x = data.frame(a = 1:2, b = c("a", "b"))
y = 1:2
cc = makeCCKriging(x = x, y = y, cat.type = "EC", par = c(1, 1))
cc.pred = makeCCPred(pred = 5, s.square = 2, x0 = data.frame(a = 1, b = "b"), model = cc)
expect_is(cc.pred, "CCPred")
expect_output(cc.pred, "CCKriging Prediction")
expect_error(makeCCPred(pred = 5, s.square = 2, x0 = data.frame(a = 1, c = "b"), model = cc),
"colnames")
expect_error(makeCCPred(pred = 5, s.square = 2, x0 = data.frame(a = 1, b = "b"),
model = makeCCKriging(x = x, y = y, cat.type = "EC")), "must not be NULL")
expect_error(makeCCPred(pred = 5, s.square = 2, x0 = data.frame(a = 1:2, b = rep("b", 2)),
model = cc), "Lengths") # lengths of pred and s.square must be equal to nrow(x0)
expect_error(makeCCPred(pred = NA, s.square = 2, x0 = data.frame(a = 1, c = "b"),
model = cc), "missing values")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.