`results` not equivalent to `results2`.
Component “rowId”: Numeric: lengths (1, 4) differ
Component “covariateId”: Numeric: lengths (1, 4) differ
Component “covariateValue”: Numeric: lengths (1, 4) differ

aggCount$covariateId not equal to results3$covariateId.
Lengths differ: 1 is not 2

aggCount$count not equal to results3$countValue.
Lengths differ: 1 is not 2

aggMax$covariateId not equal to results3$covariateId.
Lengths differ: 1 is not 2

aggMax$covariateValue not equal to results3$maxValue.
Lengths differ: 1 is not 2

<tibble_error_incompatible_size/tibble_error/rlang_error/error/condition>
Error in `tibble(Characteristic = c("    Mean", "    Std. deviation", "    Minimum", 
    "    25th percentile", "    Median", "    75th percentile", 
    "    Maximum"), value1 = c(covariatesSubset$averageValue1, 
    covariatesSubset$standardDeviation1, covariatesSubset$minValue1, 
    covariatesSubset$p25Value1, covariatesSubset$medianValue1, 
    covariatesSubset$p75Value1, covariatesSubset$maxValue1), 
    value2 = c(covariatesSubset$averageValue2, covariatesSubset$standardDeviation2, 
        covariatesSubset$minValue2, covariatesSubset$p25Value2, 
        covariatesSubset$medianValue2, covariatesSubset$p75Value2, 
        covariatesSubset$maxValue2), stdDiff = c(covariatesSubset$stdDiff, 
        "  ", "  ", "  ", "  ", "  ", "  "))`: Tibble columns must have compatible sizes.
• Size 7: Existing data.
• Size 14: Column `value1`.
ℹ Only values of size one are recycled.

# This file covers the code in Table1.R. View coverage for this file using
test_that("createTable1 works with categorical covariates", {
settings <- createCovariateSettings(useDemographicsAgeGroup = TRUE,
covariateData1 <- getDbCovariateData(connection = eunomiaConnection,
expect_error(createTable1("blah"), "not of type 'covariateData'")
expect_error(createTable1(covariateData1, output = "blah"), "The `output` argument  must be")
expect_error(createTable1(covariateData1, showCounts = F, showPercent = F), "counts or percent")
table1 <- createTable1(covariateData1, specifications = getDefaultTable1Specifications()[1:2, ])
expect_equal(names(table1)[2], "% (n = 638)")
table1 <- createTable1(covariateData1, output = "one column")
expect_equal(names(table1), c("Characteristic", "% (n = 638)"))
covariateData2 <- getDbCovariateData(connection = eunomiaConnection,
expect_error(createTable1(covariateData1, "blah"), "not of type 'covariateData'")
expect_equal(names(table1), c("Characteristic", "% (n = 638)", "% (n = 252)", "Std.Diff",
table1 <- createTable1(covariateData1, covariateData2, output = "one column")
expect_equal(names(table1), c("Characteristic", "% (n = 638)", "% (n = 252)", "Std.Diff"))
rawCovariateData <- getDbCovariateData(connection = eunomiaConnection,
expect_error(createTable1(rawCovariateData), "data is not aggregated")
expect_error(createTable1(covariateData1, rawCovariateData), "data is not aggregated")
test_that("createTable1 works with continuous covariates", {
table1 <- createTable1(covariateData1, covariateData2, output = "one column",
settings <- createCovariateSettings(useChads2Vasc = TRUE)
covariateData3 <- getDbCovariateData(connection = eunomiaConnection,
table1 <- createTable1(covariateData3, output = "one column", showCounts = T, showPercent = T)
test_that("createTable1 works with other covariates", {
spec <- spec[which(spec$label %in% c("CHADS2Vasc", "Age group")), ]
table1 <- createTable1(covariateData1, specifications = spec, output = "list")

"createTable1 works with categorical covariates"
"createTable1 works with continuous covariates"
"createTable1 works with other covariates"

createTable1 works with continuous covariates