Package: CohortConstructor Check: tests New result: ERROR Running ‘testthat.R’ [343s/178s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/tests.html > # * https://testthat.r-lib.org/reference/test_package.html#special-files > > library(testthat) > library(CohortConstructor) > > test_check("CohortConstructor") Starting 2 test processes [ FAIL 40 | WARN 155 | SKIP 51 | PASS 193 ] ══ Skipped tests (51) ══════════════════════════════════════════════════════════ • On CRAN (51): 'test-conceptCohort.R:137:3', 'test-conceptCohort.R:209:3', 'test-conceptCohort.R:237:3', 'test-conceptCohort.R:284:3', 'test-conceptCohort.R:430:3', 'test-entryAtColumnDate.R:2:3', 'test-entryAtColumnDate.R:58:3', 'test-exitAtColumnDate.R:2:3', 'test-exitAtColumnDate.R:62:3', 'test-exitAtColumnDate.R:119:3', 'test-collapseCohorts.R:95:3', 'test-intersectCohorts.R:13:3', 'test-intersectCohorts.R:77:3', 'test-intersectCohorts.R:122:3', 'test-intersectCohorts.R:221:3', 'test-intersectCohorts.R:332:3', 'test-intersectCohorts.R:373:3', 'test-exitAtDate.R:36:3', 'test-measurementCohort.R:209:3', 'test-requireCohortIntersect.R:144:3', 'test-requireCohortIntersect.R:180:3', 'test-requireConceptIntersect.R:114:3', 'test-requireConceptIntersect.R:195:3', 'test-requireDateRange.R:2:3', 'test-requireDateRange.R:102:3', 'test-requireDeathFlag.R:2:3', 'test-requireDeathFlag.R:78:3', 'test-requireDemographics.R:2:3', 'test-requireDemographics.R:130:3', 'test-requireDemographics.R:177:3', 'test-requireDemographics.R:216:3', 'test-requireDemographics.R:241:3', 'test-requireDemographics.R:265:3', 'test-requireDemographics.R:414:3', 'test-requireDemographics.R:463:3', 'test-requireDemographics.R:495:3', 'test-requireIsFirstEntry.R:24:3', 'test-requireIsFirstEntry.R:64:3', 'test-requireIsFirstEntry.R:88:3', 'test-requireTableIntersect.R:2:3', 'test-requireTableIntersect.R:102:3', 'test-requireTableIntersect.R:183:3', 'test-subsetCohorts.R:49:3', 'test-subsetCohorts.R:98:3', 'test-subsetCohorts.R:117:3', 'test-trimDemographics.R:2:3', 'test-trimDemographics.R:328:3', 'test-unionCohorts.R:143:3', 'test-unionCohorts.R:198:3', 'test-yearCohorts.R:2:3', 'test-yearCohorts.R:122:3' ══ Failed tests ════════════════════════════════════════════════════════════════ ── Failure ('test-exitAtDate.R:9:3'): exit at observation end ────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-exitAtDate.R:11:3'): exit at observation end ───────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-exitAtDate.R:13:3'): exit at observation end ───────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-exitAtDate.R:17:3'): exit at observation end ───────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-exitAtDate.R:19:3'): exit at observation end ───────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-exitAtDate.R:21:3'): exit at observation end ───────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-measurementCohort.R:42:3'): mearurementCohorts works ───────── collectCohort(cdm$cohort, 1) (`actual`) not equal to dplyr::tibble(...) (`expected`). `attr(actual, 'row.names')`: 1 `attr(expected, 'row.names')`: 1 2 actual vs expected subject_id cohort_start_date cohort_end_date - actual[1, ] 3 2015-02-19 2015-02-19 + expected[1, ] 1 2000-07-01 2000-07-01 + expected[2, ] 3 2015-02-19 2015-02-19 `actual$subject_id`: 3 `expected$subject_id`: 1 3 `actual$cohort_start_date`: "2015-02-19" `expected$cohort_start_date`: "2000-07-01" "2015-02-19" `actual$cohort_end_date`: "2015-02-19" `expected$cohort_end_date`: "2000-07-01" "2015-02-19" ── Failure ('test-measurementCohort.R:69:3'): mearurementCohorts works ───────── collectCohort(cdm$cohort3, 1) (`actual`) not equal to dplyr::tibble(...) (`expected`). `attr(actual, 'row.names')`: 1 `attr(expected, 'row.names')`: 1 2 actual vs expected subject_id cohort_start_date cohort_end_date - actual[1, ] 3 2015-02-19 2015-02-19 + expected[1, ] 1 2000-07-01 2000-07-01 + expected[2, ] 3 2015-02-19 2015-02-19 `actual$subject_id`: 3 `expected$subject_id`: 1 3 `actual$cohort_start_date`: "2015-02-19" `expected$cohort_start_date`: "2000-07-01" "2015-02-19" `actual$cohort_end_date`: "2015-02-19" `expected$cohort_end_date`: "2000-07-01" "2015-02-19" ── Failure ('test-measurementCohort.R:87:3'): mearurementCohorts works ───────── collectCohort(cdm$cohort4, 1) (`actual`) not equal to dplyr::tibble(...) (`expected`). `attr(actual, 'row.names')`: 1 2 `attr(expected, 'row.names')`: 1 2 3 4 5 actual vs expected subject_id cohort_start_date cohort_end_date - actual[1, ] 3 2015-02-19 2015-02-19 - actual[2, ] 3 2015-02-20 2015-02-20 + expected[1, ] 1 2000-07-01 2000-07-01 + expected[2, ] 1 2000-12-11 2000-12-11 + expected[3, ] 2 2002-09-08 2002-09-08 + expected[4, ] 3 2015-02-19 2015-02-19 + expected[5, ] 3 2015-02-20 2015-02-20 `actual$subject_id`: 3 3 `expected$subject_id`: 1 1 2 3 3 actual$cohort_start_date | expected$cohort_start_date [1] "2015-02-19" - "2000-07-01" [1] [2] "2015-02-20" - "2000-12-11" [2] - "2002-09-08" [3] - "2015-02-19" [4] - "2015-02-20" [5] actual$cohort_end_date | expected$cohort_end_date [1] "2015-02-19" - "2000-07-01" [1] [2] "2015-02-20" - "2000-12-11" [2] - "2002-09-08" [3] - "2015-02-19" [4] - "2015-02-20" [5] ── Failure ('test-measurementCohort.R:106:3'): mearurementCohorts works ──────── collectCohort(cdm$cohort5, 1) (`actual`) not equal to dplyr::tibble(...) (`expected`). `attr(actual, 'row.names')`: `attr(expected, 'row.names')`: 1 `actual$subject_id`: `expected$subject_id`: 1 `actual$cohort_start_date`: `expected$cohort_start_date`: "2000-07-01" `actual$cohort_end_date`: `expected$cohort_end_date`: "2000-07-01" ── Failure ('test-measurementCohort.R:143:3'): mearurementCohorts works ──────── collectCohort(cdm$cohort7, 1) (`actual`) not equal to dplyr::tibble(...) (`expected`). `attr(actual, 'row.names')`: `attr(expected, 'row.names')`: 1 `actual$subject_id`: `expected$subject_id`: 1 `actual$cohort_start_date`: `expected$cohort_start_date`: "2000-07-01" `actual$cohort_end_date`: `expected$cohort_end_date`: "2000-07-01" ── Failure ('test-measurementCohort.R:150:3'): mearurementCohorts works ──────── collectCohort(cdm$cohort7, 2) (`actual`) not equal to dplyr::tibble(...) (`expected`). `attr(actual, 'row.names')`: 1 2 `attr(expected, 'row.names')`: 1 2 3 4 actual vs expected subject_id cohort_start_date cohort_end_date - actual[1, ] 3 2015-02-19 2015-02-19 - actual[2, ] 3 2015-02-20 2015-02-20 + expected[1, ] 1 2000-12-11 2000-12-11 + expected[2, ] 2 2002-09-08 2002-09-08 + expected[3, ] 3 2015-02-19 2015-02-19 + expected[4, ] 3 2015-02-20 2015-02-20 `actual$subject_id`: 3 3 `expected$subject_id`: 1 2 3 3 actual$cohort_start_date | expected$cohort_start_date [1] "2015-02-19" - "2000-12-11" [1] [2] "2015-02-20" - "2002-09-08" [2] - "2015-02-19" [3] - "2015-02-20" [4] `actual$cohort_end_date`: "2015-02-19" "2015-02-20" `expected$cohort_end_date`: "2000-12-11" "2002-09-08" "2015-02-19" "2015-02-20" ── Failure ('test-requireCohortIntersect.R:72:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:73:3'): requiring presence in another cohort ── all(dplyr::pull(cdm$cohort5, "subject_id") == c("3", "3")) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:74:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:89:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:92:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:93:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:107:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:110:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireCohortIntersect.R:111:3'): requiring presence in another cohort ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireConceptIntersect.R:38:3'): require flag in concept ──── all(dplyr::pull(cdm$cohort3, "subject_id") == rep(1, 5)) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireConceptIntersect.R:40:3'): require flag in concept ──── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireConceptIntersect.R:54:3'): require flag in concept ──── all(dplyr::pull(cdm$cohort4, "subject_id") == c(rep(1, 5), 3)) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireConceptIntersect.R:56:3'): require flag in concept ──── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireConceptIntersect.R:68:3'): require flag in concept ──── length(dplyr::pull(cdm$cohort5, "subject_id")) == 0 is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireIsFirstEntry.R:8:3'): test restrict to first entry works ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireIsFirstEntry.R:14:3'): test restrict to first entry works ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-requireIsFirstEntry.R:18:3'): test restrict to first entry works ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-sampleCohorts.R:41:3'): sampleCohort subsetting multiple cohorts ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-sampleCohorts.R:53:3'): sampleCohort subsetting multiple cohorts ── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:9:3'): unionCohorts works ───────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:13:3'): unionCohorts works ──────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:17:3'): unionCohorts works ──────────────────── all(cdm$cohort2 %>% dplyr::pull("subject_id") %>% sort() == 1:4) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:20:3'): unionCohorts works ──────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:34:3'): unionCohorts works ──────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:38:3'): unionCohorts works ──────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:42:3'): unionCohorts works ──────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Failure ('test-unionCohorts.R:45:3'): unionCohorts works ──────────────────── all(...) is not TRUE `actual`: FALSE `expected`: TRUE ── Error ('test-unionCohorts.R:84:3'): gap and name works ────────────────────── Error in `validateGeneratedCohortSet(cohort, soft = .softValidation)`: ! 3 observations outside observation period. Backtrace: ▆ 1. └─omopgenerics::newCohortTable(cdm$cohort1) at test-unionCohorts.R:84:3 2. └─omopgenerics:::validateGeneratedCohortSet(cohort, soft = .softValidation) 3. └─omopgenerics::validateCohortArgument(...) 4. └─omopgenerics:::checkObservationPeriod(...) 5. └─cli::cli_abort(message = mes, call = call) 6. └─rlang::abort(...) [ FAIL 40 | WARN 155 | SKIP 51 | PASS 193 ] Error: Test failures Execution halted