Running 'testthat.R' [34s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(metR)
  > # library(vdiffr)
  > 
  > on_cran <- !isTRUE(as.logical(Sys.getenv("NOT_CRAN", "false")))
  > if (on_cran) data.table::setDTthreads(2)
  > 
  > test_check("metR")
  Saving _problems/test-eof-6.R
  Saving _problems/test-eof-11.R
  Saving _problems/test-eof-18.R
  Saving _problems/test-eof-31.R
  Saving _problems/test-eof-36.R
  Saving _problems/test-eof-44.R
  Saving _problems/test-eof-60.R
  Saving _problems/test-eof-65.R
  Saving _problems/test-imputeeof-8.R
  Saving _problems/test-interpolate-13.R
  Saving _problems/test-season-31.R
  Saving _problems/test-trajectory-4.R
  Saving _problems/test-vis-geom-relief-14.R
  Saving _problems/test-vis-text-contour-17.R
  Saving _problems/test-vis-text-contour-74.R
  Saving _problems/test-vis-text-contour-87.R
  Saving _problems/test-waveflux-6.R
  [ FAIL 17 | WARN 3 | SKIP 16 | PASS 159 ]
  
  ══ Skipped tests (16) ══════════════════════════════════════════════════════════
  • On CRAN (16): 'test-GetTopography.R:3:5', 'test-ReadNetCDF.R:81:5',
    'test-vis-arrow.R:9:1', 'test-vis-arrow.R:31:1', 'test-vis-contour2.R:10:1',
    'test-vis-contour2.R:24:1', 'test-vis-contour2.R:34:1',
    'test-vis-contour2.R:52:1', 'test-vis-contour2.R:71:1',
    'test-vis-contour_fill.R:11:1', 'test-vis-contour_fill.R:25:1',
    'test-vis-contour_fill.R:36:1', 'test-vis-discretised-scale.R:12:1',
    'test-vis-guide_colorstrip.R:13:1', 'test-vis-streamline.R:18:1',
    'test-vis-streamline.R:27:1'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-eof.R:6:9'): EOF runs ──────────────────────────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_s3_class(...) at test-eof.R:5:5
   2. │ └─testthat::quasi_label(enquo(object))
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─metR::EOF(gh ~ lat + lon | date, data = geopotential, n = 1) at test-eof.R:6:9
   5.   └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   6.     ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   7.     └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-eof.R:11:5'): EOF, returns correct PCs ─────────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-eof.R:11:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. ├─base::nrow(EOF(gh ~ lat + lon | date, data = geopotential, n = 2)$sdev)
   5. └─metR::EOF(gh ~ lat + lon | date, data = geopotential, n = 2)
   6.   └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   7.     ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   8.     └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-eof.R:18:9'): EOF uses bootstrap ───────────────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_s3_class(...) at test-eof.R:16:5
   2. │ └─testthat::quasi_label(enquo(object))
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─metR::EOF(...) at test-eof.R:18:9
   5.   └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   6.     ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   7.     └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-eof.R:28:5'): can use differnet engine ─────────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-eof.R:28:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─metR::EOF(gh ~ lat + lon | date, data = geopotential, engine = base::svd)
   5.   └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   6.     ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   7.     └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-eof.R:35:5'): EOF works inside data.table ──────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_equal(...) at test-eof.R:35:5
    2. │ └─testthat::quasi_label(enquo(object), label)
    3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
    4. ├─geopotential[, EOF(gh ~ lon + lat | date)$left]
    5. └─data.table:::`[.data.table`(...)
    6.   └─base::eval(jsub, SDenv, parent.frame())
    7.     └─base::eval(jsub, SDenv, parent.frame())
    8.       └─metR::EOF(gh ~ lon + lat | date)
    9.         └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   10.           ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   11.           └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-eof.R:41:5'): EOF rotates ──────────────────────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_identical(...) at test-eof.R:41:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─metR::EOF(...)
   5.   └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   6.     ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   7.     └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Failure ('test-eof.R:59:5'): EOF fails gracefully ───────────────────────────
  `EOF(gh ~ lon | date, data = geopotential)` threw an error with unexpected message.
  Expected match: "The formula gh ~ lon | date  does not identify an unique observation for each cell."
  Actual message: "attempt access index 3/3 in VECTOR_ELT"
  Backtrace:
      ▆
   1. ├─testthat::expect_error(...) at test-eof.R:59:5
   2. │ └─testthat:::quasi_capture(...)
   3. │   ├─testthat (local) .capture(...)
   4. │   │ └─base::withCallingHandlers(...)
   5. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
   6. └─metR::EOF(gh ~ lon | date, data = geopotential)
   7.   └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   8.     ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   9.     └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-eof.R:64:5'): eof methods ──────────────────────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─metR::EOF(...) at test-eof.R:64:5
   2.   └─metR:::.tidy2matrix(data, dcast.formula, value.var, fill = fill)
   3.     ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   4.     └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-imputeeof.R:8:1'): (code run outside of `test_that()`) ─────────
  Error in ``[.data.table`(geopotential, , `:=`(gh.t, Anomaly(gh)), by = .(lat, lon, month(date)))`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─geopotential[, `:=`(gh.t, Anomaly(gh)), by = .(lat, lon, month(date))] at test-imputeeof.R:8:1
   2. └─data.table:::`[.data.table`(...) at test-imputeeof.R:8:1
  ── Error ('test-interpolate.R:13:5'): interpolate works ────────────────────────
  Error in ``[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_known_value(...) at test-interpolate.R:13:5
    2. │ └─testthat::quasi_label(enquo(object), label)
    3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
    4. ├─geopotential[, Interpolate(gh ~ lon + lat, x.out, y.out)]
    5. └─data.table:::`[.data.table`(...)
    6.   └─base::eval(jsub, SDenv, parent.frame())
    7.     └─base::eval(jsub, SDenv, parent.frame())
    8.       └─metR::Interpolate(gh ~ lon + lat, x.out, y.out)
    9.         └─metR:::.tidy2matrix(data, dcast.formula, value.var = value.var)
   10.           ├─data[, `:=`(row__, .GRP), by = c(row.vars)]
   11.           └─data.table:::`[.data.table`(data, , `:=`(row__, .GRP), by = c(row.vars))
  ── Error ('test-season.R:29:5'): full season works ─────────────────────────────
  Error in ``[.data.table`(data.table::data.table(times, year, season), , `:=`(n, .N), by = .(year, season))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-season.R:29:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─metR::is.full_season(...)
   5.   ├─...[]
   6.   └─data.table:::`[.data.table`(...)
  ── Error ('test-trajectory.R:4:1'): (code run outside of `test_that()`) ────────
  Error in ``[.data.table`(geopotential, , `:=`(c("u", "v"), GeostrophicWind(gh, lon, lat)), by = date)`: attempt access index 5/5 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─...[] at test-trajectory.R:4:1
   2. └─data.table:::`[.data.table`(...) at test-trajectory.R:4:1
  ── Error ('test-vis-geom-relief.R:11:5'): geom-relief ──────────────────────────
  Error in `geom_relief(aes(z = value))`: Problem while converting geom to grob.
  ℹ Error occurred in the 1st layer.
  Caused by error in `[.data.table`:
  ! attempt access index 16/16 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─vdiffr::expect_doppelganger(...) at test-vis-geom-relief.R:11:5
    2. │ └─vdiffr (local) writer(fig, testcase, title)
    3. │   ├─vdiffr:::print_plot(plot, title)
    4. │   └─vdiffr:::print_plot.ggplot(plot, title)
    5. │     ├─base::print(p)
    6. │     └─ggplot2 (local) `print.ggplot2::ggplot`(p)
    7. │       ├─ggplot2::ggplot_gtable(data)
    8. │       └─ggplot2 (local) `ggplot_gtable.ggplot2::ggplot_built`(data)
    9. │         └─ggplot2:::by_layer(...)
   10. │           ├─rlang::try_fetch(...)
   11. │           │ ├─base::tryCatch(...)
   12. │           │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
   13. │           │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   14. │           │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
   15. │           │ └─base::withCallingHandlers(...)
   16. │           └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
   17. │             └─l$draw_geom(d, layout)
   18. │               └─ggplot2 (local) draw_geom(..., self = self)
   19. │                 └─self$geom$draw_layer(...)
   20. │                   └─ggplot2 (local) draw_layer(..., self = self)
   21. │                     └─base::lapply(...)
   22. │                       └─ggplot2 (local) FUN(X[[i]], ...)
   23. │                         ├─rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
   24. │                         └─self$draw_panel(...)
   25. │                           └─metR (local) draw_panel(...)
   26. │                             ├─coords[, `:=`(dx, .derv(z, x, fill = TRUE)), by = y]
   27. │                             └─data.table:::`[.data.table`(...)
   28. └─base::.handleSimpleError(...)
   29.   └─rlang (local) h(simpleError(msg, call))
   30.     └─handlers[[1L]](cnd)
   31.       └─cli::cli_abort(...)
   32.         └─rlang::abort(...)
  ── Error ('test-vis-text-contour.R:13:5'): contour_text wokrs ──────────────────
  Error in `geom_text_contour(aes(z = gh))`: Problem while converting geom to grob.
  ℹ Error occurred in the 2nd layer.
  Caused by error in `[.data.table`:
  ! attempt access index 18/18 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─vdiffr::expect_doppelganger(...) at test-vis-text-contour.R:13:5
    2. │ └─vdiffr (local) writer(fig, testcase, title)
    3. │   ├─vdiffr:::print_plot(plot, title)
    4. │   └─vdiffr:::print_plot.ggplot(plot, title)
    5. │     ├─base::print(p)
    6. │     └─ggplot2 (local) `print.ggplot2::ggplot`(p)
    7. │       ├─ggplot2::ggplot_gtable(data)
    8. │       └─ggplot2 (local) `ggplot_gtable.ggplot2::ggplot_built`(data)
    9. │         └─ggplot2:::by_layer(...)
   10. │           ├─rlang::try_fetch(...)
   11. │           │ ├─base::tryCatch(...)
   12. │           │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
   13. │           │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   14. │           │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
   15. │           │ └─base::withCallingHandlers(...)
   16. │           └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
   17. │             └─l$draw_geom(d, layout)
   18. │               └─ggplot2 (local) draw_geom(..., self = self)
   19. │                 └─self$geom$draw_layer(...)
   20. │                   └─ggplot2 (local) draw_layer(..., self = self)
   21. │                     └─base::lapply(...)
   22. │                       └─ggplot2 (local) FUN(X[[i]], ...)
   23. │                         ├─rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
   24. │                         └─self$draw_panel(...)
   25. │                           └─metR (local) draw_panel(...)
   26. │                             ├─data[, `:=`(N, .N), by = .(group, piece)]
   27. │                             └─data.table:::`[.data.table`(...)
   28. └─base::.handleSimpleError(...)
   29.   └─rlang (local) h(simpleError(msg, call))
   30.     └─handlers[[1L]](cnd)
   31.       └─cli::cli_abort(...)
   32.         └─rlang::abort(...)
  ── Error ('test-vis-text-contour.R:69:5'): stroke.colour is aesthetic ──────────
  Error in `geom_text_contour(aes(z = gh, stroke.colour = after_stat(level)), stroke = 0.2)`: Problem while converting geom to grob.
  ℹ Error occurred in the 2nd layer.
  Caused by error in `[.data.table`:
  ! attempt access index 18/18 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─vdiffr::expect_doppelganger(...) at test-vis-text-contour.R:69:5
    2. │ └─vdiffr (local) writer(fig, testcase, title)
    3. │   ├─vdiffr:::print_plot(plot, title)
    4. │   └─vdiffr:::print_plot.ggplot(plot, title)
    5. │     ├─base::print(p)
    6. │     └─ggplot2 (local) `print.ggplot2::ggplot`(p)
    7. │       ├─ggplot2::ggplot_gtable(data)
    8. │       └─ggplot2 (local) `ggplot_gtable.ggplot2::ggplot_built`(data)
    9. │         └─ggplot2:::by_layer(...)
   10. │           ├─rlang::try_fetch(...)
   11. │           │ ├─base::tryCatch(...)
   12. │           │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
   13. │           │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   14. │           │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
   15. │           │ └─base::withCallingHandlers(...)
   16. │           └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
   17. │             └─l$draw_geom(d, layout)
   18. │               └─ggplot2 (local) draw_geom(..., self = self)
   19. │                 └─self$geom$draw_layer(...)
   20. │                   └─ggplot2 (local) draw_layer(..., self = self)
   21. │                     └─base::lapply(...)
   22. │                       └─ggplot2 (local) FUN(X[[i]], ...)
   23. │                         ├─rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
   24. │                         └─self$draw_panel(...)
   25. │                           └─metR (local) draw_panel(...)
   26. │                             ├─data[, `:=`(N, .N), by = .(group, piece)]
   27. │                             └─data.table:::`[.data.table`(...)
   28. └─base::.handleSimpleError(...)
   29.   └─rlang (local) h(simpleError(msg, call))
   30.     └─handlers[[1L]](cnd)
   31.       └─cli::cli_abort(...)
   32.         └─rlang::abort(...)
  ── Error ('test-vis-text-contour.R:80:5'): geom_label_contour also work ────────
  Error in `geom_label_contour(aes(z = gh, fill = after_stat(level)), label.r = unit(0.25, "lines"), label.padding = unit(0.15, "lines"), label.size = 0)`: Problem while converting geom to grob.
  ℹ Error occurred in the 2nd layer.
  Caused by error in `[.data.table`:
  ! attempt access index 18/18 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─vdiffr::expect_doppelganger(...) at test-vis-text-contour.R:80:5
    2. │ └─vdiffr (local) writer(fig, testcase, title)
    3. │   ├─vdiffr:::print_plot(plot, title)
    4. │   └─vdiffr:::print_plot.ggplot(plot, title)
    5. │     ├─base::print(p)
    6. │     └─ggplot2 (local) `print.ggplot2::ggplot`(p)
    7. │       ├─ggplot2::ggplot_gtable(data)
    8. │       └─ggplot2 (local) `ggplot_gtable.ggplot2::ggplot_built`(data)
    9. │         └─ggplot2:::by_layer(...)
   10. │           ├─rlang::try_fetch(...)
   11. │           │ ├─base::tryCatch(...)
   12. │           │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
   13. │           │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
   14. │           │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
   15. │           │ └─base::withCallingHandlers(...)
   16. │           └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
   17. │             └─l$draw_geom(d, layout)
   18. │               └─ggplot2 (local) draw_geom(..., self = self)
   19. │                 └─self$geom$draw_layer(...)
   20. │                   └─ggplot2 (local) draw_layer(..., self = self)
   21. │                     └─base::lapply(...)
   22. │                       └─ggplot2 (local) FUN(X[[i]], ...)
   23. │                         ├─rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
   24. │                         └─self$draw_panel(...)
   25. │                           └─metR (local) draw_panel(..., self = self)
   26. │                             ├─data[, `:=`(N, .N), by = .(group, piece)]
   27. │                             └─data.table:::`[.data.table`(...)
   28. └─base::.handleSimpleError(...)
   29.   └─rlang (local) h(simpleError(msg, call))
   30.     └─handlers[[1L]](cnd)
   31.       └─cli::cli_abort(...)
   32.         └─rlang::abort(...)
  ── Error ('test-waveflux.R:6:5'): waveflux returns w.x and w.y ─────────────────
  Error in ``[.data.table`(dt, , `:=`(psi.dx = Derivate(psi ~ lonrad, cyclical = TRUE)[[1]], psi.dxx = Derivate(psi ~ lonrad, 2, cyclical = TRUE)[[1]]), by = lat)`: attempt access index 9/9 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─base::with(geo, WaveFlux(gh, u, v, lon, lat, lev = 700)) at test-waveflux.R:6:5
   2. └─base::with.default(geo, WaveFlux(gh, u, v, lon, lat, lev = 700))
   3.   └─base::eval(substitute(expr), data, enclos = parent.frame())
   4.     └─base::eval(substitute(expr), data, enclos = parent.frame())
   5.       └─metR::WaveFlux(gh, u, v, lon, lat, lev = 700)
   6.         ├─...[]
   7.         └─data.table:::`[.data.table`(...)
  
  [ FAIL 17 | WARN 3 | SKIP 16 | PASS 159 ]
  Error:
  ! Test failures.
  Execution halted