context("test-arithmentic_strictness.R")
ratings <- read.csv(file=here("datasets/small.csv"), header = FALSE, sep = ",")
rating_matrix <- data.matrix(ratings)
test_that("doc means are being calculated correctly", {
subject <- arithmetic_strictness_env(rating_matrix)$doc_means
expect_equal(subject, rbind(2.50, 1.75, 1.25)[, 1])
})
test_that("global mean is being calculated correctly", {
subject <- arithmetic_strictness_env(rating_matrix)$arithmetic_mean_of_all_documents
expect_equal(round(subject, digits = 2), 1.83)
})
test_that("strictness vector is being calculated correctly", {
subject <- arithmetic_strictness_env(rating_matrix)$arithmetic_strictness_vector
rounded <- subject %>% round(digits = 2) %>% as.matrix %>% t
rounded %>% print
cbind(0.46, 0.92, 1.83, 5.5000000) %>% print
expect_equal(rounded, cbind(0.46, 0.92, 1.83, 5.5000000)[1,])
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.