Running examples in ‘phenofit-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: roughFit
> ### Title: Rough fitting
> ### Aliases: roughFit
> ### Keywords: internal
> 
> ### ** Examples
> 
> data("CA_NS6")
> d <- CA_NS6
> 
> nptperyear <- 23
> INPUT <- check_input(d$t, d$y, d$w,
+     QC_flag = d$QC_flag,
+     nptperyear = nptperyear, south = FALSE,
+     maxgap = nptperyear / 4, alpha = 0.02, wmin = 0.2
+ )
> # plot_input(INPUT)
> 
> wFUN <- "wTSM"
> # all year as a whole
> options = list(rFUN = "smooth_wWHIT", wFUN = wFUN, lambda = 10)
> brks <- season(INPUT, lambda = 10)
> plot_season(INPUT, brks, d)
> 
> brks2 = season_input(INPUT, options)
> all.equal(brks2, brks)
[1] TRUE
> 
> c(d_fit, info_peak) %<-% roughFit(INPUT)
> d_season = find_season.peaks(d_fit, info_peak)
> 
> c(t, ypred) %<-% d_fit[, .(t, ziter2)]
> d_season = find_season.default(ypred, t)
> all.equal(brks$dt, d_season)
[1] TRUE
> 
> # opt <- .options$season
> # brks$fit - d_fit # function passed test
> 
> # curve fitting by year
> brks_mov <- season_mov(INPUT,
+     options = list(
+         rFUN = "smooth_wWHIT", wFUN = wFUN,
+         lambda = 10,
+         r_min = 0.05, ypeak_min = 0.05,
+         verbose = TRUE
+     )
+ )
  [season_mov] running 1 ... 
iloop = 1: lambda = 10.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 2: lambda = 5.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 3: lambda = 2.5, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
  [season_mov] running 2 ... 
iloop = 1: lambda = 10.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 2: lambda = 5.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 3: lambda = 2.5, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
  [season_mov] running 3 ... 
iloop = 1: lambda = 10.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 2: lambda = 5.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 3: lambda = 2.5, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
  [season_mov] running 4 ... 
iloop = 1: lambda = 10.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 2: lambda = 5.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 3: lambda = 2.5, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
  [season_mov] running 5 ... 
iloop = 1: lambda = 10.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 2: lambda = 5.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 3: lambda = 2.5, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
  [season_mov] running 6 ... 
iloop = 1: lambda = 10.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 2: lambda = 5.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 3: lambda = 2.5, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
  [season_mov] running 7 ... 
iloop = 1: lambda = 10.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 2: lambda = 5.0, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
iloop = 3: lambda = 2.5, ntrough_PerYear = 0.00, npeak_PerYear = 0.00
> plot_season(INPUT, brks_mov)
> 
> rfit <- brks2rfit(brks_mov)
> r <- get_pheno(rfit)
Error in `str_replace_all()`:
! 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)
  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]][[1L]], dots[[2L]][[1L]])
  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(., "-+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. └─base::.handleSimpleError(...)
 24.   └─stringr (local) h(simpleError(msg, call))
 25.     └─cli::cli_abort(...)
 26.       └─rlang::abort(...)
Execution halted
Examples with CPU (user + system) or elapsed time > 5s
           user system elapsed
curvefits 4.427  0.114   5.758