test_that("con_table: One parameter is non-numeric", {
A <- 10
B <- "Twenty"
C <- 30
D <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
FALSE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"Error: table parameters are not of type 'numeric'."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"NA: contingency table incomplete."
)
})
test_that("con_table: Missing nref", {
A <- 10
B <- NA
C <- 30
D <- NA
nexp <- 50
nref <- NA
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
FALSE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"Error: missing group totals."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"NA: contingency table incomplete."
)
})
test_that("con_table: Missing A", {
A <- NA
B <- 20
C <- 30
D <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"OK: parameters pass checks for contingency table."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"con_table_pos_tot"
)
})
test_that("con_table: Missing B", {
A <- 10
B <- NA
C <- 30
D <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"OK: parameters pass checks for contingency table."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"con_table_pos_tot"
)
})
test_that("con_table: Missing A and C", {
A <- NA
B <- 20
C <- NA
D <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"OK: parameters pass checks for contingency table."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"con_table_pos_tot"
)
})
test_that("con_table: Missing A and B", {
A <- NA
B <- NA
C <- 30
D <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
FALSE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"Error: could not determine table type."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"NA: could not determine table type."
)
})
test_that("con_table: Good pos total", {
A <- 10
B <- NA
C <- 30
D <- NA
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"OK: parameters pass checks for contingency table."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"con_table_pos_tot"
)
})
test_that("con_table: Good neg total", {
A <- NA
B <- 20
C <- NA
D <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"OK: parameters pass checks for contingency table."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"con_table_pos_tot"
)
})
test_that("con_table: Good full table", {
A <- 10
B <- 20
C <- 30
D <- 40
nexp <- 50
nref <- 100
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[1]],
TRUE
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[2]],
"OK: parameters pass checks for contingency table."
)
expect_identical(
validate_contingency_table(A, B, C, D, nexp, nref)[[3]],
"con_table_pos_tot"
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.