context("preprocess")
test_that("Correct vocabulary extraction", {
expect_equal(getVocabulary("ABC"), c("a", "b", "c"))
expect_equal(getVocabulary("CBA"), c("a", "b", "c"))
expect_equal(getVocabulary("AAA"), c("a"))
expect_equal(getVocabulary("012"), c("0", "1", "2"))
expect_equal(getVocabulary("()/"), c("(", ")", "/"))
expect_equal(getVocabulary(" a "), c(" ", "a"))
expect_equal(getVocabulary("abc"), c("a","b","c"))
expect_equal(getVocabulary(123),c("1","2","3"))
expect_equal(getVocabulary(c("A","B","C",1)),c("\n","1","a","b","c"))
expect_equal(getVocabulary("\n"),c("\n"))
expect_error(getVocabulary(""))
expect_error(getVocabulary())
expect_is(getVocabulary("abc"),"character")
expect_message(getVocabulary("abc", verbose = T))
expect_silent(getVocabulary("abc"))
})
test_that("Generating semi-redundant chunks", {
expect_is(preprocessSemiRedundant(char = "abcd", maxlen = 2),"list")
expect_is(preprocessSemiRedundant(char = "abcd", maxlen = 2)$X,"array")
expect_is(preprocessSemiRedundant(char = "abcd", maxlen = 2)$Y,"matrix")
expect_equivalent(lengths(preprocessSemiRedundant(char = "abcd", maxlen = 2))[1], 16)
expect_equivalent(lengths(preprocessSemiRedundant(char = "abcd", maxlen = 2, vocabulary = c("a","b","c","d")))[1], 16)
expect_equivalent(lengths(preprocessSemiRedundant(char = "abcd", maxlen = 2))[2], 8)
expect_equivalent(preprocessSemiRedundant(char = "abcd", maxlen = 2)$Y, matrix(c(0,0,1,0,0,0,0,1), byrow = TRUE, nrow = 2))
expect_equivalent(length(preprocessSemiRedundant(char="abcd", maxlen = 2)),2)
expect_error(preprocessSemiRedundant(char = "abcd", maxlen = ""))
expect_error(preprocessSemiRedundant(char = "abcd", maxlen = 0))
expect_error(preprocessSemiRedundant(char = "abcd", vocabulary = ""))
expect_error(preprocessSemiRedundant(char = "abcd", vocabulary = 0))
expect_message(preprocessSemiRedundant(char = "abcd", maxlen = 2, verbose = T))
expect_silent(preprocessSemiRedundant(char = "abcd", maxlen = 2))
expect_type(preprocessSemiRedundant(char = "abcd", maxlen = 2)$X, "double")
expect_type(preprocessSemiRedundant(char = "abcd", maxlen = 2)$Y, "double")
})
test_that("Generating semi-redundant chunks from Fasta files", {
file <- file.path("fasta/a.fasta")
expect_is(preprocessFasta(file),"list")
expect_is(preprocessFasta(file)$X,"array")
expect_is(preprocessFasta(file)$Y,"matrix")
expect_equivalent(lengths(preprocessFasta(file))[2], 39672)
expect_equivalent(length(preprocessFasta(file)),2)
expect_error(preprocessFasta())
expect_error(preprocessFasta(""))
expect_silent(preprocessFasta(file))
expect_type(preprocessFasta(file)$X, "double")
expect_type(preprocessFasta(file)$Y, "double")
})
# TODO: test shuffling
test_that("Checking the generator for the Fasta files", {
expect_error(sequenceToArray())
expect_error(sequenceToArray(""))
testpath <- file.path("fasta_2")
vocabulary = c("a", "c", "g", "t")
batch.size <- 5
maxlen <- 3
gen <- fastaFileGenerator(corpus.dir = testpath, batch.size = batch.size, maxlen = maxlen, showWarnings = FALSE, vocabulary = vocabulary)
arrays <- gen()
expect_equivalent(dim(arrays[[1]])[1], batch.size)
expect_equivalent(dim(arrays[[1]])[2], maxlen)
expect_equivalent(dim(arrays[[1]])[3], length(vocabulary))
expect_equivalent(dim(arrays[[2]])[1], batch.size)
expect_equivalent(dim(arrays[[2]])[2], length(vocabulary))
expect_equivalent(length(arrays),2)
# a.fasta file starts with aaccggtt
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 2, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 3, ], c(0, 1, 0, 0)) # c
expect_equivalent(arrays[[2]][1, ], c(0, 1, 0, 0)) # c
arrays_2 <- gen()
expect_equivalent(arrays_2[[1]][2, 1, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays_2[[1]][2, 2, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays_2[[1]][2, 3, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays_2[[2]][2, ], c(0, 0, 0, 1)) # t
# test transition to second fasta file
gen <- fastaFileGenerator(corpus.dir = testpath, batch.size = batch.size, maxlen = maxlen, showWarnings = FALSE, vocabulary = vocabulary)
for (i in 1:5){
arrays <- gen()
}
# samples start at beginning of b.fasta
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 2, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 3, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][5, 1, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][5, 2, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][5, 3, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[2]][5, ], c(1, 0, 0, 0)) # a
# complete one iteration (100 samples)
gen <- fastaFileGenerator(corpus.dir = testpath, batch.size = batch.size, maxlen = maxlen, showWarnings = FALSE, vocabulary = vocabulary)
for (i in 1:9){
arrays <- gen()
}
# start from a.fasta again
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 2, ], c(1, 0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 3, ], c(0, 1, 0, 0)) # c
expect_equivalent(arrays[[2]][1, ], c(0, 1, 0, 0)) # c
###################
# test for different step size
gen <- fastaFileGenerator(corpus.dir = testpath, batch.size = 4, maxlen = 3, step = 2, showWarnings = FALSE)
arrays <- gen()
expect_equivalent(arrays[[1]][3, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 3, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[2]][3, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][4, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][4, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][4, 3, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[2]][4, ], c(1, 0, 0, 0))
####
# tests with chars outside vocabulary, vocabulary does not contain "A"
gen <- fastaFileGenerator(corpus.dir = testpath, batch.size = 5, maxlen = 3, step = 2, showWarnings = FALSE, vocabulary = c("c", "g", "t"))
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 2, ], c(0, 0, 0)) # a
expect_equivalent(arrays[[1]][1, 3, ], c(1, 0, 0)) # c
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0)) # c
####
# test reverse complement
gen <- fastaFileGenerator(corpus.dir = testpath, batch.size = 6, maxlen = 3, step = 4, showWarnings = FALSE,
vocabulary = c("a", "c", "g", "t"), reverseComplements = TRUE)
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 3, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[2]][1, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][2, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][2, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][2, 3, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[2]][2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][3, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][3, 3, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[2]][3, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][4, 1, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][4, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][4, 3, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[2]][4, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][5, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][5, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][5, 3, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[2]][5, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][6, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][6, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][6, 3, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[2]][6, ], c(0, 0, 0, 1))
####
# test padding
gen <- fastaFileGenerator(corpus.dir = testpath, batch.size = 1, maxlen = 10, step = 4, showWarnings = FALSE,
vocabulary = c("a", "c", "g", "t"))
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(0, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(0, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 3, ], c(0, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 4, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 5, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 6, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][1, 7, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][1, 8, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][1, 9, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][1, 10, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[2]][1, ], c(0, 0, 0, 1))
####
expect_error(fastaFileGenerator())
expect_error(fastaFileGenerator(""))
expect_is(fastaFileGenerator(testpath, batch.size = batch.size, maxlen = maxlen, showWarnings = FALSE), "function")
expect_is(gen(), "list")
expect_is(gen()[[1]], "array")
expect_is(gen()[[2]], "matrix")
expect_message(fastaFileGenerator(testpath, batch.size = batch.size, maxlen = maxlen,
showWarnings = FALSE, verbose = T))
expect_silent(fastaFileGenerator(testpath, batch.size = batch.size, maxlen = maxlen, showWarnings = FALSE))
# no T in vocabulary
expect_warning(fastaFileGenerator(testpath, batch.size = batch.size, maxlen = maxlen,
vocabulary = c("a", "c", "g"), showWarnings = TRUE))
expect_type(gen()[[1]], "double")
expect_type(gen()[[2]], "double")
############# Test label generator (header) #############
testpath <- file.path("fasta_2")
gen <- fastaLabelGenerator(corpus.dir = testpath, batch.size = 5, maxlen = 3, step = 2, showWarnings = FALSE, vocabulary = c("a", "c", "g", "t"),
reverseComplement = FALSE, labelVocabulary = c("w", "x", "y"))
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0)) # A
expect_equivalent(arrays[[1]][1, 2, ], c(1, 0, 0, 0)) # A
expect_equivalent(arrays[[1]][1, 3, ], c(0, 1, 0, 0)) # C
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0)) # W
expect_equivalent(arrays[[1]][5, 1, ], c(1, 0, 0, 0)) # A
expect_equivalent(arrays[[1]][5, 2, ], c(1, 0, 0, 0)) # A
expect_equivalent(arrays[[1]][5, 3, ], c(0, 0, 0, 1)) # T
expect_equivalent(arrays[[2]][5, ], c(0, 1, 0)) # W
gen <- fastaLabelGenerator(corpus.dir = testpath, batch.size = 8, maxlen = 7, step = 2, showWarnings = FALSE, vocabulary = c("a", "c", "g", "t"),
reverseComplement = FALSE, labelVocabulary = c("w", "x", "y"))
arrays <- gen()
# go through a/b.fasta once discard samples with target z
expect_equivalent(arrays[[1]][8, 1, ], c(1, 0, 0, 0)) # A
expect_equivalent(arrays[[1]][8, 2, ], c(1, 0, 0, 0)) # A
expect_equivalent(arrays[[1]][8, 3, ], c(0, 1, 0, 0)) # C
expect_equivalent(arrays[[2]][8, ], c(1, 0, 0)) # W
gen <- fastaLabelGenerator(corpus.dir = testpath, batch.size = 8, maxlen = 7, step = 1, showWarnings = FALSE, vocabulary = c("a", "c", "g", "t"),
reverseComplement = TRUE, labelVocabulary = c("w", "x", "y"))
arrays <- gen()
# half of batch should be reverse complement
expect_equivalent(arrays[[1]][1, 7:1, ], arrays[[1]][5, , c(4,3,2,1)])
expect_equivalent(arrays[[1]][2, 7:1, ], arrays[[1]][6, , c(4,3,2,1)])
expect_equivalent(arrays[[1]][3, 7:1, ], arrays[[1]][7, , c(4,3,2,1)])
expect_equivalent(arrays[[1]][4, 7:1, ], arrays[[1]][8, , c(4,3,2,1)])
expect_equivalent(arrays[[2]][1:4, ], arrays[[2]][5:8, ])
})
############# Test label generator (folder) #############
directories <- c("label_folder/x", "label_folder/y", "label_folder/z")
val <- FALSE
initializeGenerators(directories = directories,
format = "fasta",
batch.size = 6,
maxlen = 2,
vocabulary = c("a", "c", "g", "t"),
step = 2)
gen <- labelByFolderGeneratorWrapper(val = val, path = directories)
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][2, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][2, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][3, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][4, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][4, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][5, 1, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][5, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][6, 1, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][6, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][2, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][3, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][4, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][5, ], c(0, 0, 1))
expect_equivalent(arrays[[2]][6, ], c(0, 0, 1))
# test skipping file
for (i in 1:2){
arrays <- gen()
}
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][2, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][2, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 1, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][4, 1, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][4, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][5, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][5, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][6, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][6, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][2, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][3, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][4, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][5, ], c(0, 0, 1))
expect_equivalent(arrays[[2]][6, ], c(0, 0, 1))
#
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][2, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][2, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][4, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][4, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][5, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][5, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][6, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][6, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][2, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][3, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][4, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][5, ], c(0, 0, 1))
expect_equivalent(arrays[[2]][6, ], c(0, 0, 1))
# reverse complement
initializeGenerators(directories = directories,
format = "fasta",
batch.size = 6,
maxlen = 2,
vocabulary = c("a", "c", "g", "t"),
reverseComplements = TRUE,
step = 100)
gen <- labelByFolderGeneratorWrapper(val = val, path = directories)
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][2, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][2, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][3, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][4, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][4, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][5, 1, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][5, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][6, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][6, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][2, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][3, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][4, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][5, ], c(0, 0, 1))
expect_equivalent(arrays[[2]][6, ], c(0, 0, 1))
#
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][2, 1, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][2, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][3, 1, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][4, 1, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][4, 2, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][5, 1, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][5, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][6, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][6, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][2, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][3, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][4, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][5, ], c(0, 0, 1))
expect_equivalent(arrays[[2]][6, ], c(0, 0, 1))
#
arrays <- gen()
expect_equivalent(arrays[[1]][1, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][1, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][2, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][2, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][3, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][3, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][4, 1, ], c(0, 0, 1, 0))
expect_equivalent(arrays[[1]][4, 2, ], c(0, 1, 0, 0))
expect_equivalent(arrays[[1]][5, 1, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][5, 2, ], c(1, 0, 0, 0))
expect_equivalent(arrays[[1]][6, 1, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[1]][6, 2, ], c(0, 0, 0, 1))
expect_equivalent(arrays[[2]][1, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][2, ], c(1, 0, 0))
expect_equivalent(arrays[[2]][3, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][4, ], c(0, 1, 0))
expect_equivalent(arrays[[2]][5, ], c(0, 0, 1))
expect_equivalent(arrays[[2]][6, ], c(0, 0, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.