arithmetic_strictness_env <- function(rating_matrix) {
env <- new.env()
# Vector of all "document means". Each item in the vector
# is the arithmetic mean of ratings of a single document
env$doc_means <- rating_matrix %>% apply(1, mean, na.rm = TRUE)
# arithmetic mean of all documents (points "average" document)
# This is the "mean of document means"
env$arithmetic_mean_of_all_documents <- mean(env$doc_means, na.rm = TRUE)
env$X <- env$arithmetic_mean_of_all_documents # shorthand
# average points for a document for a fixed reviewer.
# The notation l is adopted from the documentation section. It's just a
# random letter.
env$X_l <- function(reviewer_column) {
mean(reviewer_column, na.rm = TRUE)
}
# Arithmetic strictness
env$arithmetic_strictness <- function(reviewer_column) {
env$X / env$X_l(reviewer_column)
}
env$arithmetic_strictness_vector <- rating_matrix %>% apply(2, env$arithmetic_strictness)
env
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.