library(testthat)
library(data.summary)
context("Data Summary")
test_that("Calculated Correctly", {
x <- 1:10
statistics <- data.frame("Mean" = 5.5, "Var." = 55/6, 'Min.'= 1, 'Max.' = 10)
expect_equal(data_summary(x), statistics)
y <- c( -3, 50, 5, -11, 4)
statistics <- data.frame("Mean" = 9, "Var." = 566.5, 'Min.'= -11, 'Max.' = 50)
expect_equal(data_summary(y), statistics)
z <- rnorm(20)
statistics <- data.frame("Mean" = mean(z), "Var." = sd(z)^2, 'Min.' = min(z), 'Max.' = max(z))
expect_equal(data_summary(z), statistics)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.