test_that("lin_model works", {
set.seed(123)
x = rnorm(10)
x2 = rnorm(10)
y = rnorm(10)
df = data.frame(y, x, x2)
expect_equal(lin_model(y~x+x2, data = df)$beta, lm(y~x+x2, data = df)$coefficients)
expect_equal(lin_model(y~x+x2, data = df, weights = 1:10)$beta,
lm(y~x+x2, data = df, weights = 1:10)$coefficients)
expect_error(lin_model(y+x~x2, data = df), regexp = NULL)
expect_error(lin_model(y~x+x2, data = df, weights = 1:9), regexp = NULL)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.