Running ‘testthat.R’ [54s/58s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(phenofit)
  > 
  > test_check("phenofit")
  List of 5
   $ AG    : tibble [6 × 8] (S3: tbl_df/tbl/data.frame)
   $ Beck  : tibble [6 × 7] (S3: tbl_df/tbl/data.frame)
   $ Elmore: tibble [6 × 8] (S3: tbl_df/tbl/data.frame)
   $ Gu    : tibble [6 × 10] (S3: tbl_df/tbl/data.frame)
   $ Zhang : tibble [6 × 8] (S3: tbl_df/tbl/data.frame)
  NULL
  # A tibble: 6 × 8
    flag      t0    mn    mx     rsp    a3     rau    a5
    <chr>  <dbl> <dbl> <dbl>   <dbl> <dbl>   <dbl> <dbl>
  1 1999_1 -135. 0.201 0.636 0.00932  2.85 0.00852  2   
  2 2000_1  189. 0.238 0.635 0.0126   2.47 0.00801  3.21
  3 2001_1  569. 0.252 0.626 0.0108   2.96 0.00950  2.96
  4 2002_1  892. 0.253 0.614 0.0159   2    0.00724  3.08
  5 2003_1 1268. 0.236 0.577 0.0121   2.88 0.00723  2.88
  6 2004_1 1676. 0.202 0.576 0.00839  2.81 0.00980  3.52
       meth        R2       NSE         R         RMSE        pvalue n_sim
     <char>     <num>     <num>     <num>        <num>         <num> <num>
  1:     AG 0.9986908 0.9985845 0.9993452 9.940385e-03  4.489925e-65    46
  2:   Beck 1.0000000 1.0000000 1.0000000 4.932917e-10  0.000000e+00    46
  3: Elmore 1.0000000 1.0000000 1.0000000 3.945072e-10  0.000000e+00    46
  4:     Gu 1.0000000 1.0000000 1.0000000 8.315171e-11  0.000000e+00    46
  5:  Zhang 1.0000000 1.0000000 1.0000000 5.529117e-06 8.044939e-208    46
  $AG
   formula:	mn + (mx - mn) * exp(-((t0 - t) * rsp)^a3)
    formula:	mn + (mx - mn) * exp(-((t - t0) * rau)^a5)
  pars:
               t0        mn        mx         rsp a3         rau a5
  nlminb 149.8926 0.1020656 0.7095242 0.009389263  6 0.009367765  6
  
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 1.65502e-16); attempting approx solution
  
  warning: solve(): system is singular (rcond: 2.19427e-17); attempting approx solution
  
  warning: solve(): system is singular (rcond: 1.65502e-16); attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 1.33432e-17); attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 2.38811e-17); attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 2.03034e-17); attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 1.33432e-17); attempting approx solution
  
  warning: solve(): system is singular (rcond: 3.31005e-17); attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 3.08395e-17); attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 2.36432e-17); attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular; attempting approx solution
  
  warning: solve(): system is singular (rcond: 6.97437e-18); attempting approx solution
  [ FAIL 2 | WARN 2 | SKIP 0 | PASS 66 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-PhenoExtract.R:63:5'): get_pheno.rfit works ────────────────────
  Error in `str_replace_all(x, "\\++0\\++", . %>% replace("+"))`: Failed to apply `replacement` function.
  ℹ It must accept a character vector of any length.
  Caused by error in `rep()`:
  ! invalid 'times' argument
  Backtrace:
       ▆
    1. ├─phenofit::get_pheno(rfit) at test-PhenoExtract.R:63:5
    2. ├─phenofit:::get_pheno.rfit(rfit)
    3. │ └─... %>% set_names(dt$flag)
    4. ├─dplyr::group_map(...)
    5. ├─dplyr:::group_map.data.frame(...)
    6. │ └─dplyr:::map2(chunks, group_keys, .f, ...)
    7. │   └─base::mapply(.f, .x, .y, MoreArgs = list(...), SIMPLIFY = FALSE)
    8. │     └─phenofit (local) `<fn>`(dots[[1L]][[4L]], dots[[2L]][[4L]])
    9. │       └─phenofit:::PhenoDeriv.default(values, t, der1, IsPlot = FALSE)
   10. │         └─phenofit::findpeaks(...)
   11. │           └─xc %<>% str_replace_midzero()
   12. ├─phenofit:::str_replace_midzero(.)
   13. │ ├─str_replace_all(x, "\\++0\\++", . %>% replace("+")) %>% ...
   14. │ └─stringr::str_replace_all(x, "\\++0\\++", . %>% replace("+"))
   15. │   └─stringr:::str_transform_all(string, pattern, replacement)
   16. │     ├─base::withCallingHandlers(...)
   17. │     └─magrittr (local) replacement(old_flat)
   18. │       └─magrittr::freduce(value, `_function_list`)
   19. │         ├─base::withVisible(function_list[[k]](value))
   20. │         └─function_list[[k]](value)
   21. │           └─phenofit (local) replace(., "+")
   22. │             └─base::paste(rep(replacement, nchar(x)), collapse = "")
   23. ├─stringr::str_replace_all(., "-+0-+", . %>% replace("-"))
   24. │ └─stringr:::str_transform_all(string, pattern, replacement)
   25. │   └─stringr::str_locate_all(string, pattern)
   26. │     └─stringr:::check_lengths(string, pattern)
   27. │       └─vctrs::vec_size_common(...)
   28. └─base::.handleSimpleError(...)
   29.   └─stringr (local) h(simpleError(msg, call))
   30.     └─cli::cli_abort(...)
   31.       └─rlang::abort(...)
  ── Error ('test-season.R:34:5'): `season` with smooth_wSG ──────────────────────
  Error in `str_replace_all(., "-+0-+", . %>% replace("-"))`: Failed to apply `replacement` function.
  ℹ It must accept a character vector of any length.
  Caused by error in `rep()`:
  ! invalid 'times' argument
  Backtrace:
       ▆
    1. ├─testthat::expect_silent(brks <- do.call(season, param)) at test-season.R:34:5
    2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise)
    3. │   ├─testthat (local) .capture(...)
    4. │   │ ├─withr::with_output_sink(...)
    5. │   │ │ └─base::force(code)
    6. │   │ ├─base::withCallingHandlers(...)
    7. │   │ └─base::withVisible(code)
    8. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    9. ├─base::do.call(season, param)
   10. ├─phenofit (local) `<fn>`(...)
   11. │ └─phenofit:::findpeaks_season(...)
   12. │   └─phenofit::findpeaks(...)
   13. │     └─xc %<>% str_replace_midzero()
   14. ├─phenofit:::str_replace_midzero(.)
   15. │ └─str_replace_all(x, "\\++0\\++", . %>% replace("+")) %>% ...
   16. ├─stringr::str_replace_all(., "-+0-+", . %>% replace("-"))
   17. │ └─stringr:::str_transform_all(string, pattern, replacement)
   18. │   ├─base::withCallingHandlers(...)
   19. │   └─magrittr (local) replacement(old_flat)
   20. │     └─magrittr::freduce(value, `_function_list`)
   21. │       ├─base::withVisible(function_list[[k]](value))
   22. │       └─function_list[[k]](value)
   23. │         └─phenofit (local) replace(., "-")
   24. │           └─base::paste(rep(replacement, nchar(x)), collapse = "")
   25. └─base::.handleSimpleError(...)
   26.   └─stringr (local) h(simpleError(msg, call))
   27.     └─cli::cli_abort(...)
   28.       └─rlang::abort(...)
  
  [ FAIL 2 | WARN 2 | SKIP 0 | PASS 66 ]
  Error: Test failures
  Execution halted