[R] Warning message: In length(barlist) == 1 && as.character(barlist[[1]][[2]]) == "1"

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Apr 21 13:43:59 CEST 2023

On Thu, 20 Apr 2023 10:11:03 +0200
Giozz Lau <giozzlau using gmail.com> wrote:

> I am writing to seek assistance regarding a warning message that I
> encountered while running a CLMM with two main factors and one random
> factor ("participants"). One of the main factors consists of six
> levels that can be either categorical or numerical.

Debugging, like the CLMM modelling that you're trying to perform here,
can be described as a kind of inverse problem: given experimental data
('Some kind of warning is raised by length(barlist) == 1 &&
as.character(barlist[[1]][[2]]) == "1"'), one intends to model the
state of the program at the time when the problem happens (since it's
the whole expression that raises the warning and not any of its parts,
perhaps barlist[[1]][[2]] is of length() > 1? But that's an error in
recent versions of R, and used to be a warning in a few older
versions...) and go about solving the problem from there.

Sometimes, there's not enough experimental data, and the problem
becomes ill-posed: strictly speaking, given the information above,
there can be too many possible explanations for what you're
experiencing. I see you've provided some information, but it's better
to start with the full error message, the code you're running and a
small piece of data that would reproduce the error on a different

Sometimes, it's possible to apply one's psychic debugging skills (read:
make educated guesses and hope they are right) to regularise the
ill-posed problem and solve it anyway. Searching CRAN for "clmm" yields
the "ordinal" package, which has a clmm() function, which calls another
function to operate on a variable called "barlist" and which also has
been recently (November 2022) changed to read:

>> length(barlist) == 1 && as.character(barlist[[1]][[2]])[1] == "1"

(Note the extra [1] compared to the expression in your warning message.)

Have you tried upgrading to ordinal version 2022.11-16?

If that doesn't help, please provide the full warning, the code and the
data to reproduce it, and the sessionInfo() output.

Best regards,

More information about the R-help mailing list