# context("test-plotScatter")
X <- matrix(rnorm(200), nrow = 10, ncol = 20)
Y1 <- matrix(rnorm(200), nrow = 10, ncol = 20)
X1 <- matrix(rnorm(200), nrow = 5)
X2 <- c(1,2,3,4,5)
Y2 <- c(1,2,3,4,5)
groups1 <- c(rep("A",5),rep("B",5))
groups <- rep("A",5)
out <- PMA::CCA(X, Y1, typex = "standard", typez="standard", penaltyx = 0.5, penaltyz = 0.5, K=1, standardize = F, trace = F)
out1 <- PMA::CCA(X, Y1, typex = "standard", typez="standard", penaltyx = 0.5, penaltyz = 0.5, K=3, standardize = F, trace = F)
out2 <- NULL
test_that("Can identify correct input", {
expect_error(plotScatter(X1, Y1, K = 1, groups = groups1, CCA_out = out1))
expect_error(plotScatter(X1, Y1, K = 1, groups = groups, CCA_out = out1))
expect_error(plotScatter(X1, Y1, K = "1", groups = groups1, CCA_out = out1))
expect_error(plotScatter(X2, Y1, K = 1, groups = groups1, CCA_out = out1))
expect_error(plotScatter(X, Y2, K = 1, groups = groups1, CCA_out = out1))
# expect_error(plotScatter(X, Y1, K = 1, groups = groups1, CCA_out = out1))
expect_error(plotScatter(X, Y1, K = 2, groups = groups1, CCA_out = out))
expect_error(plotScatter(X, Y1, K = 1, groups = groups1, CCA_out = out2))
})
test_that("Can output correct values", {
expect_length(plotScatter(X, Y1, K = 1, groups = groups1, CCA_out = out1), 1)
expect_length(plotScatter(X, Y1, K = 2, groups = groups1, CCA_out = out1), 2)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.