Thanks for the suggestion, Ivan.

The issue has been overcome with a simple change of the code to the form

(is.null(A) || any(is.na(A))

following advice from Peter Dalgard.

However, I have kept a note of the R Inferno reference, for future problems.

Best wishes,

Adelchi


> On 9 Apr 2024, at 12:22, Ivan Krylov <ikry...@disroot.org> wrote:
> 
> В Tue, 9 Apr 2024 12:04:26 +0200
> Adelchi Azzalini <azzal...@stat.unipd.it> пишет:
> 
>> res <- CEoptim(sumsqrs, f.arg = list(xt), continuous = list(mean =
>> c(0, 0, 0), sd = rep(1,    3), conMat = A, conVec = b), discrete =
>> list(categories = c(298L, 298L), smoothProb = 0.5),    N = 10000, rho
>> = 0.001)
>> 
>> Error in is.null(A) || is.na(A) : 
>>  'length = 18' in coercion to 'logical(1)'
> 
> There is a book titled "The R Inferno" with lots of debugging tips for
> R: https://www.burns-stat.com/documents/books/the-r-inferno/
> 
> Start with a traceback(). Which function gave a matrix to the ||
> operator (which accepts only logical scalars)?
> 
> If traceback is not enough, use options(error = recover). Once the
> error happens, you will be able to inspect local variables inside any
> of the active call frames, which may help understand where did A come
> from and why it was given to the || operator.
> 
> Good luck!
> 
> -- 
> Best regards,
> Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to