Package: CMAverse
Function: cmest()
Version: 0.1.0.9000
R version: R version 4.2.1 (2022-06-23)
❓ Problem
I encountered a recurring error when using cmest() with a binary mediator and specifying multiple possible values via the mval argument. Although the documentation says to use:
mediator = "crp_75"
mval = list(c("0", "1"))
… this throws an error internally:
Erreur dans if (!mval[[i]] %in% m_lev) : la condition est de longueur > 1
This suggests that the code is incorrectly checking whether a vector (mval[[i]]) is contained in another vector (m_lev) using a scalar condition — possibly like this:
if (!mval[[i]] %in% m_lev)
Which fails when mval[[i]] has length > 1.
✅ Expected behavior
According to the documentation, mval should be a list whose elements can be vectors, as long as the list has the same length as mediator. So:
mval = list(c("0", "1"))
… should work for a single binary mediator.
Package: CMAverse
Function: cmest()
Version: 0.1.0.9000
R version: R version 4.2.1 (2022-06-23)
❓ Problem
I encountered a recurring error when using cmest() with a binary mediator and specifying multiple possible values via the mval argument. Although the documentation says to use:
mediator = "crp_75"
mval = list(c("0", "1"))
… this throws an error internally:
Erreur dans if (!mval[[i]] %in% m_lev) : la condition est de longueur > 1
This suggests that the code is incorrectly checking whether a vector (mval[[i]]) is contained in another vector (m_lev) using a scalar condition — possibly like this:
if (!mval[[i]] %in% m_lev)
Which fails when mval[[i]] has length > 1.
✅ Expected behavior
According to the documentation, mval should be a list whose elements can be vectors, as long as the list has the same length as mediator. So:
mval = list(c("0", "1"))
… should work for a single binary mediator.