Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(cleanEHR)
  > 
  > 
  > test_check("cleanEHR")
  ── 1. Error: (unknown) (@test_0_load_xml.r#9)  ─────────────────────────────────
  SETLENGTH() cannot be applied to an ALTVEC object.
  1: create_cctable(ccd, "../data/ANALYSIS_REF.yaml", 1) at testthat/test_0_load_xml.r:9
  2: cct$create_table(freq)
  3: .self$torigin[, TRUE, by = c("site", "episode_id")]
  4: `[.data.table`(.self$torigin, , TRUE, by = c("site", "episode_id"))
  
  ── 2. Error: test create table (@test_ccdatatable.r#20)  ───────────────────────
  object 'ccd' not found
  1: suppressWarnings(deltaTime(ccd, pseudotime = TRUE)) at testthat/test_ccdatatable.r:20
  2: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
  3: deltaTime(ccd, pseudotime = TRUE)
  
  ── 3. Error: test get_missingness (@test_ccdatatable.r#35)  ────────────────────
  SETLENGTH() cannot be applied to an ALTVEC object.
  1: tb$create_table(freq = 1) at testthat/test_ccdatatable.r:35
  2: .self$torigin[, TRUE, by = c("site", "episode_id")]
  3: `[.data.table`(.self$torigin, , TRUE, by = c("site", "episode_id"))
  
  ── 4. Error: test filter missingness (@test_ccdatatable.r#85)  ─────────────────
  SETLENGTH() cannot be applied to an ALTVEC object.
  1: missingness_run(list(seq(10)), "nimporte_quoi") at testthat/test_ccdatatable.r:85
  2: tb$create_table(freq = 1) at testthat/test_ccdatatable.r:78
  3: .self$torigin[, TRUE, by = c("site", "episode_id")]
  4: `[.data.table`(.self$torigin, , TRUE, by = c("site", "episode_id"))
  
  ── 5. Error: test imputation (@test_ccdatatable.r#129)  ────────────────────────
  SETLENGTH() cannot be applied to an ALTVEC object.
  1: imputation_run(list(c(1, 1, NA, 1))) at testthat/test_ccdatatable.r:129
  2: tb$create_table(freq = 1) at testthat/test_ccdatatable.r:124
  3: .self$torigin[, TRUE, by = c("site", "episode_id")]
  4: `[.data.table`(.self$torigin, , TRUE, by = c("site", "episode_id"))
  
  ── 6. Error: test create2dclean2 (@test_create2dclean.r#20)  ───────────────────
  SETLENGTH() cannot be applied to an ALTVEC object.
  1: pseudoepisode(5) at testthat/test_create2dclean.r:20
  2: cr + new.episode(ep) at testthat/test_create2dclean.r:10
  3: cr + new.episode(ep)
  4: index.record(e1)
  5: id[, `:=`("pid", .GRP), by = "id"]
  6: `[.data.table`(id, , `:=`("pid", .GRP), by = "id")
  
  ── 7. Error: create demographic table from ccdata and expect the equivalent
      
  object 'ccd' not found
  1: ccd_demographic_table(ccd, dtype = FALSE) at testthat/test_demographics.r:5
  2: for_each_episode(record, function(x) {
         demog.data <- rep("NULL", length(all.demcode))
         names(demog.data) <- all.demcode
         demog.data <- as.list(demog.data)
         for (item in names(x@data)) {
             if (length(x@data[[item]]) == 1) {
                 demog.data[[item]] <- x@data[[item]]
             }
         }
         env$demogls[[length(env$demogls) + 1]] <- .simple.data.frame(demog.data)
     })
  3: lapply(record@episodes, fun)
  
  ── 8. Error: range filters (@test_range_filter.r#21)  ──────────────────────────
  object 'tb' not found
  1: .handleSimpleError(function (e) 
     {
         handled <<- TRUE
         test_error <<- e
         options(expressions = expressions_opt_new)
         on.exit(options(expressions = expressions_opt), add = TRUE)
         e$expectation_calls <- frame_calls(11, 2)
         test_error <<- e
         register_expectation(e)
         e$handled <- TRUE
         test_error <<- e
     }, "object 'tb' not found", quote(eval(code, test_env))) at testthat/test_range_filter.r:21
  2: eval(code, test_env)
  
  ── 9. Error: all filters (@test_range_filter.r#27)  ────────────────────────────
  object 'tb' not found
  1: .handleSimpleError(function (e) 
     {
         handled <<- TRUE
         test_error <<- e
         options(expressions = expressions_opt_new)
         on.exit(options(expressions = expressions_opt), add = TRUE)
         e$expectation_calls <- frame_calls(11, 2)
         test_error <<- e
         register_expectation(e)
         e$handled <- TRUE
         test_error <<- e
     }, "object 'tb' not found", quote(eval(code, test_env))) at testthat/test_range_filter.r:27
  2: eval(code, test_env)
  
  ── 10. Error: check when item t_admission or t_discharge is missing (@test_reall
  object 'ccd' not found
  1: deltaTime(ccd, pseudotime = TRUE) at testthat/test_reallocateTime.r:40
  
  ── 11. Error: testing unique spell (@test_record2.r#42)  ───────────────────────
  SETLENGTH() cannot be applied to an ALTVEC object.
  1: ccd + new.episode(list(NIHR_HIC_ICU_0073 = "NHS1", NIHR_HIC_ICU_0411 = "2000-01-03", 
         NIHR_HIC_ICU_0412 = "2000-01-30")) at testthat/test_record2.r:42
  2: ccd + new.episode(list(NIHR_HIC_ICU_0073 = "NHS1", NIHR_HIC_ICU_0411 = "2000-01-03", 
         NIHR_HIC_ICU_0412 = "2000-01-30"))
  3: index.record(e1)
  4: id[, `:=`("pid", .GRP), by = "id"]
  5: `[.data.table`(id, , `:=`("pid", .GRP), by = "id")
  
  ── 12. Error: file level summary (@test_report.r#5)  ───────────────────────────
  object 'ccd' not found
  1: expect_equal(nrow(file.summary(ccd)), length(unique(ccd@infotb$parse_file))) at testthat/test_report.r:5
  2: quasi_label(enquo(object), label)
  3: eval_bare(get_expr(quo), get_env(quo))
  4: nrow(file.summary(ccd))
  5: file.summary(ccd)
  
  ── 13. Error: table1 (@test_report.r#10)  ──────────────────────────────────────
  object 'ccd' not found
  1: suppressWarnings(ccd_demographic_table(ccd)) at testthat/test_report.r:10
  2: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
  3: ccd_demographic_table(ccd)
  4: for_each_episode(record, function(x) {
         demog.data <- rep("NULL", length(all.demcode))
         names(demog.data) <- all.demcode
         demog.data <- as.list(demog.data)
         for (item in names(x@data)) {
             if (length(x@data[[item]]) == 1) {
                 demog.data[[item]] <- x@data[[item]]
             }
         }
         env$demogls[[length(env$demogls) + 1]] <- .simple.data.frame(demog.data)
     })
  5: lapply(record@episodes, fun)
  
  ── 14. Error: demographic data completeness (@test_report.r#18)  ───────────────
  object 'ccd' not found
  1: suppressWarnings(ccd_demographic_table(ccd)) at testthat/test_report.r:18
  2: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
  3: ccd_demographic_table(ccd)
  4: for_each_episode(record, function(x) {
         demog.data <- rep("NULL", length(all.demcode))
         names(demog.data) <- all.demcode
         demog.data <- as.list(demog.data)
         for (item in names(x@data)) {
             if (length(x@data[[item]]) == 1) {
                 demog.data[[item]] <- x@data[[item]]
             }
         }
         env$demogls[[length(env$demogls) + 1]] <- .simple.data.frame(demog.data)
     })
  5: lapply(record@episodes, fun)
  
  ── 15. Error: calculate total data point (@test_report.r#27)  ──────────────────
  object 'ccd' not found
  1: expect_equal(total.data.point(ccd), 25) at testthat/test_report.r:27
  2: quasi_label(enquo(object), label)
  3: eval_bare(get_expr(quo), get_env(quo))
  4: total.data.point(ccd)
  5: unlist(for_each_episode(ccd, function(x) {
         sum(vapply(x@data, get.rows, 1))
     }))
  6: for_each_episode(ccd, function(x) {
         sum(vapply(x@data, get.rows, 1))
     })
  7: lapply(record@episodes, fun)
  
  ── 16. Error: calculate 2D sample rate (@test_report.r#35)  ────────────────────
  object 'ccdt' not found
  1: create_cctable(ccdt, conf = list(NIHR_HIC_ICU_0108 = list()), freq = 1) at testthat/test_report.r:35
  2: ccTable(record = rec, conf = conf)
  3: new(structure("ccTable", package = "cleanEHR"), ...)
  4: initialize(value, ...)
  5: initialize(value, ...)
  6: methods::initRefFields(.Object, classDef, selfEnv, list(...))
  
  ── 17. Error:  (@test_selectTable.r#24)  ───────────────────────────────────────
  object 'ccdt' not found
  1: itemsToDataFrame(ccdt@episodes[[1]], "NIHR_HIC_ICU_0108", 2, 1) at testthat/test_selectTable.r:24
  
  ── 18. Error:  (@test_selectTable.r#30)  ───────────────────────────────────────
  object 'ccdt' not found
  1: ccd_select_table(ccdt, items_opt = "NIHR_HIC_ICU_0108", freq = 1) at testthat/test_selectTable.r:30
  2: for_each_episode(record, function(ep) {
         if (all(items_obg %in% names(ep@data))) {
             result <- list()
             period_length <- getEpisodePeriod(ep)
             if (!is.null(period_length)) {
                 if (period_length > 0) {
                     result <- append(result, itemsToDataFrame(ep, all_items, period_length, 
                       freq))
                     nlength <- length(result[["time"]])
                     result[["site"]] <- rep(ep@site_id, nlength)
                     result[["episode_id"]] <- rep(ep@episode_id, nlength)
                     env$lt[[length(lt) + 1]] <- .simple.data.frame(result)
                 }
             }
         }
     })
  3: lapply(record@episodes, fun)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 89 SKIPPED: 9 FAILED: 18
  1. Error: (unknown) (@test_0_load_xml.r#9) 
  2. Error: test create table (@test_ccdatatable.r#20) 
  3. Error: test get_missingness (@test_ccdatatable.r#35) 
  4. Error: test filter missingness (@test_ccdatatable.r#85) 
  5. Error: test imputation (@test_ccdatatable.r#129) 
  6. Error: test create2dclean2 (@test_create2dclean.r#20) 
  7. Error: create demographic table from ccdata and expect the equivalent
            results with or without data type awareness. (@test_demographics.r#5) 
  8. Error: range filters (@test_range_filter.r#21) 
  9. Error: all filters (@test_range_filter.r#27) 
  1. ...
  
  Error: testthat unit tests failed
  Execution halted