Error when checking examples (devtools::check() function)

Hi,

I am getting error from the devtools::check() function while testing the function example:

* checking examples ... ERROR
Running examples in ‘TSstudio-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: train_model
> ### Title: Train, Test, Evaluate, and Forecast Multiple Time Series
> ###   Forecasting Models
> ### Aliases: train_model
> 
> ### ** Examples
> 
.
.
.
.
 ----------- FAILURE REPORT -------------- 
 --- failure: length > 1 in coercion to logical ---
 --- srcref --- 
: 
 --- package (from environment) --- 
TSstudio
 --- call from context --- 
train_model(input = USgas, methods = methods, train_method = list(partitions = 6, 
    sample.out = 12, space = 3), horizon = 12, error = "MAPE")
 --- call from argument --- 
level <= 0 || level > 100
 --- R stacktrace ---
where 1: train_model(input = USgas, methods = methods, train_method = list(partitions = 6, 
    sample.out = 12, space = 3), horizon = 12, error = "MAPE")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 

Any idea what causing this error? as I am not able to reproduce this error when running the example in a clean environment.

The full look of the error is available here: https://win-builder.r-project.org/p1ik8pV1o6xF/00check.log

Thanks,
Rami

This is what triggered the error on the check:

if(base::all(!is.numeric(level)) ||
     base::any(level %% 1 != 0) ||
     base::any(level  <= 0 || level > 100)){
    stop("Error on the 'level' argument: the argument is out of range (0,100]")
  }

It seems liked that you cannon use the || operator within any function. The following solve this issue:

if(base::all(!is.numeric(level)) ||
     base::any(level %% 1 != 0) ||
     base::any(level  <= 0 | level > 100)){
    stop("Error on the 'level' argument: the argument is out of range (0,100]")
  }

Best,
Rami

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.