Running ‘testthat.R’ [6s/7s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(data.table)
  
  Attaching package: 'data.table'
  
  The following object is masked from 'package:base':
  
      %notin%
  
  > library(testthat)
  > library(OBIC)
  > 
  > setDTthreads(1)
  > test_check("OBIC")
  Saving _problems/test-crop_rotation-10.R
  Saving _problems/test-grass_age-9.R
  Saving _problems/test-nematode-118.R
  Saving _problems/test-nematode-156.R
  Saving _problems/test-nematode-187.R
  Saving _problems/test-obic_farm-4.R
  Saving _problems/test-obic_field_dt-115.R
  Saving _problems/test-obic_field_dt-144.R
  Saving _problems/test-recommendations-6.R
  [ FAIL 9 | WARN 0 | SKIP 0 | PASS 160 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-crop_rotation.R:2:3'): calc_grass_age works ────────────────────
  Error in ``[.data.table`(dt, , `:=`(this_frc, sum(sel)/.N), by = ID)`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-crop_rotation.R:2:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─OBIC::calc_rotation_fraction(...)
   5.   ├─dt[, `:=`(this_frc, sum(sel)/.N), by = ID]
   6.   └─data.table:::`[.data.table`(...)
  ── Error ('test-grass_age.R:2:3'): calc_grass_age works ────────────────────────
  Error in ``[.data.table`(dt, , `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass))`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-grass_age.R:2:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─OBIC::calc_grass_age(...)
   5.   ├─dt[, `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass)]
   6.   └─data.table:::`[.data.table`(...)
  ── Error ('test-nematode.R:93:3'): ind_nematodes works with complete input ─────
  Error in ``[.data.table`(dt.melt, , `:=`(value, evaluate_logistic(x = number, b = nem_b, x0 = nem_x, v = nem_v, increasing = FALSE)), by = c("element"))`: attempt access index 7/7 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-nematode.R:93:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─OBIC::ind_nematodes(...)
   5.   ├─...[]
   6.   └─data.table:::`[.data.table`(...)
  ── Error ('test-nematode.R:131:3'): ind_nematodes works with complete input but with missing values ──
  Error in ``[.data.table`(dt.melt, , `:=`(value, evaluate_logistic(x = number, b = nem_b, x0 = nem_x, v = nem_v, increasing = FALSE)), by = c("element"))`: attempt access index 7/7 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-nematode.R:131:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─OBIC::ind_nematodes(...)
   5.   ├─...[]
   6.   └─data.table:::`[.data.table`(...)
  ── Error ('test-nematode.R:162:3'): ind_nematodes works with incomplete input ──
  Error in ``[.data.table`(dt.melt, , `:=`(value, evaluate_logistic(x = number, b = nem_b, x0 = nem_x, v = nem_v, increasing = FALSE)), by = c("element"))`: attempt access index 7/7 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-nematode.R:162:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─OBIC::ind_nematodes(...)
   5.   ├─...[]
   6.   └─data.table:::`[.data.table`(...)
  ── Error ('test-obic_farm.R:4:1'): (code run outside of `test_that()`) ─────────
  Error in ``[.data.table`(dt, , `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass))`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
       ▆
    1. └─OBIC::obic_farm(dt) at test-obic_farm.R:4:1
    2.   └─OBIC::obic_field_dt(dt = dt, output = c("scores", "indicators"))
    3.     └─OBIC::obic_field(...)
    4.       ├─dt[, `:=`(D_GA, calc_grass_age(ID, B_LU_BRP))]
    5.       └─data.table:::`[.data.table`(...)
    6.         └─base::eval(jsub, SDenv, parent.frame())
    7.           └─base::eval(jsub, SDenv, parent.frame())
    8.             └─OBIC::calc_grass_age(ID, B_LU_BRP)
    9.               ├─dt[, `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass)]
   10.               └─data.table:::`[.data.table`(...)
  ── Error ('test-obic_field_dt.R:61:3'): obic_field_dt works ────────────────────
  Error in ``[.data.table`(dt, , `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass))`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_equal(...) at test-obic_field_dt.R:61:3
    2. │ └─testthat::quasi_label(enquo(object), label)
    3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
    4. └─OBIC::obic_field_dt(tdt)
    5.   └─OBIC::obic_field(...)
    6.     ├─dt[, `:=`(D_GA, calc_grass_age(ID, B_LU_BRP))]
    7.     └─data.table:::`[.data.table`(...)
    8.       └─base::eval(jsub, SDenv, parent.frame())
    9.         └─base::eval(jsub, SDenv, parent.frame())
   10.           └─OBIC::calc_grass_age(ID, B_LU_BRP)
   11.             ├─dt[, `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass)]
   12.             └─data.table:::`[.data.table`(...)
  ── Error ('test-obic_field_dt.R:130:3'): obic_field_dt() works with just required columns ──
  Error in ``[.data.table`(dt, , `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass))`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_equal(...) at test-obic_field_dt.R:130:3
    2. │ └─testthat::quasi_label(enquo(object), label)
    3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
    4. └─OBIC::obic_field_dt(stdt, output = "scores")
    5.   └─OBIC::obic_field(...)
    6.     ├─dt[, `:=`(D_GA, calc_grass_age(ID, B_LU_BRP))]
    7.     └─data.table:::`[.data.table`(...)
    8.       └─base::eval(jsub, SDenv, parent.frame())
    9.         └─base::eval(jsub, SDenv, parent.frame())
   10.           └─OBIC::calc_grass_age(ID, B_LU_BRP)
   11.             ├─dt[, `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass)]
   12.             └─data.table:::`[.data.table`(...)
  ── Error ('test-recommendations.R:6:1'): (code run outside of `test_that()`) ───
  Error in ``[.data.table`(dt, , `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass))`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
       ▆
    1. └─OBIC::obic_farm(dt) at test-recommendations.R:6:1
    2.   └─OBIC::obic_field_dt(dt = dt, output = c("scores", "indicators"))
    3.     └─OBIC::obic_field(...)
    4.       ├─dt[, `:=`(D_GA, calc_grass_age(ID, B_LU_BRP))]
    5.       └─data.table:::`[.data.table`(...)
    6.         └─base::eval(jsub, SDenv, parent.frame())
    7.           └─base::eval(jsub, SDenv, parent.frame())
    8.             └─OBIC::calc_grass_age(ID, B_LU_BRP)
    9.               ├─dt[, `:=`(grass_age, rev(cumsum(grass))), by = rleid(ID, grass)]
   10.               └─data.table:::`[.data.table`(...)
  
  [ FAIL 9 | WARN 0 | SKIP 0 | PASS 160 ]
  Error:
  ! Test failures.
  Execution halted