Running ‘testthat.R’ [7s/6s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(sleepr)
  Loading required package: behavr
  Loading required package: data.table
  
  Attaching package: 'data.table'
  
  The following object is masked from 'package:base':
  
      %notin%
  
  > 
  > test_check("sleepr")
  Saving _problems/test-max_velocity_detector-10.R
  Saving _problems/test-max_velocity_detector-22.R
  Saving _problems/test-prepare_data_for_motion_detector-14.R
  Saving _problems/test-sleep_annotation-6.R
  Saving _problems/test-sleep_annotation-31.R
  Saving _problems/test-virtual_beam_cross_detector-10.R
  [ FAIL 6 | WARN 0 | SKIP 1 | PASS 25 ]
  
  ══ Skipped tests (1) ═══════════════════════════════════════════════════════════
  • empty test (1): 'test-bout_analysis.R:3:1'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-max_velocity_detector.R:10:3'): max_velocity_detector works ────
  Error in ``[.data.table`(data, , `:=`(n_points, .N), by = t_w)`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─sleepr::max_velocity_detector(data, 10) at test-max_velocity_detector.R:10:3
   2.   └─sleepr:::prepare_data_for_motion_detector(...)
   3.     └─sleepr:::curate_sparse_roi_data(d)
   4.       ├─data[, `:=`(n_points, .N), by = t_w]
   5.       └─data.table:::`[.data.table`(data, , `:=`(n_points, .N), by = t_w)
  ── Error ('test-max_velocity_detector.R:21:3'): max_velocity_detector wans when no interaction and masking ──
  Error in ``[.data.table`(data, , `:=`(n_points, .N), by = t_w)`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_warning(...) at test-max_velocity_detector.R:21:3
    2. │ └─testthat:::quasi_capture(...)
    3. │   ├─testthat (local) .capture(...)
    4. │   │ └─base::withCallingHandlers(...)
    5. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    6. └─sleepr::max_velocity_detector(data, 10)
    7.   └─sleepr:::prepare_data_for_motion_detector(...)
    8.     └─sleepr:::curate_sparse_roi_data(d)
    9.       ├─data[, `:=`(n_points, .N), by = t_w]
   10.       └─data.table:::`[.data.table`(data, , `:=`(n_points, .N), by = t_w)
  ── Error ('test-prepare_data_for_motion_detector.R:11:3'): prepare_data_for_motion_detector works ──
  Error in ``[.data.table`(data, , `:=`(n_points, .N), by = t_w)`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─sleepr:::prepare_data_for_motion_detector(...) at test-prepare_data_for_motion_detector.R:11:3
   2.   └─sleepr:::curate_sparse_roi_data(d)
   3.     ├─data[, `:=`(n_points, .N), by = t_w]
   4.     └─data.table:::`[.data.table`(data, , `:=`(n_points, .N), by = t_w)
  ── Error ('test-sleep_annotation.R:6:3'): sleep_annotation works return expected results ──
  Error in ``[.data.table`(data, , `:=`(n_points, .N), by = t_w)`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─sleepr::sleep_annotation(data, motion_detector_FUN = virtual_beam_cross_detector) at test-sleep_annotation.R:6:3
   2.   └─sleepr (local) wrapped(data)
   3.     └─sleepr (local) motion_detector_FUN(d, time_window_length, ...)
   4.       └─sleepr:::prepare_data_for_motion_detector(...)
   5.         └─sleepr:::curate_sparse_roi_data(d)
   6.           ├─data[, `:=`(n_points, .N), by = t_w]
   7.           └─data.table:::`[.data.table`(data, , `:=`(n_points, .N), by = t_w)
  ── Error ('test-sleep_annotation.R:31:3'): sleep_annotation works for single or multiple animals ──
  Error in ``[.data.table`(data, , `:=`(n_points, .N), by = t_w)`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─sleepr::sleep_annotation(data[id == 1][, -"id", with = F], motion_detector_FUN = virtual_beam_cross_detector) at test-sleep_annotation.R:31:3
   2.   └─sleepr (local) wrapped(data)
   3.     └─sleepr (local) motion_detector_FUN(d, time_window_length, ...)
   4.       └─sleepr:::prepare_data_for_motion_detector(...)
   5.         └─sleepr:::curate_sparse_roi_data(d)
   6.           ├─data[, `:=`(n_points, .N), by = t_w]
   7.           └─data.table:::`[.data.table`(data, , `:=`(n_points, .N), by = t_w)
  ── Error ('test-virtual_beam_cross_detector.R:10:3'): virtual_beam_cross_detector works ──
  Error in ``[.data.table`(data, , `:=`(n_points, .N), by = t_w)`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─sleepr::virtual_beam_cross_detector(data, 10) at test-virtual_beam_cross_detector.R:10:3
   2.   └─sleepr:::prepare_data_for_motion_detector(...)
   3.     └─sleepr:::curate_sparse_roi_data(d)
   4.       ├─data[, `:=`(n_points, .N), by = t_w]
   5.       └─data.table:::`[.data.table`(data, , `:=`(n_points, .N), by = t_w)
  
  [ FAIL 6 | WARN 0 | SKIP 1 | PASS 25 ]
  Error:
  ! Test failures.
  Execution halted