Error message "...missing value where TRUE/FALSE needed"

12 views
Skip to first unread message

Edward Rigdon

unread,
Feb 18, 2026, 9:34:44 PM (2 days ago) Feb 18
to lav...@googlegroups.com
Yu, Schuberth & Henseler (2023) present an example of the H-O
specification where first order constructs are common factors but
there is a second order construct modeled according to the H-O
specification. I was trying to apply the H-O specification at both
orders, when my very complex syntax produced an error message in
Rstudio:

Error in if (formul1$elem.text[jj] == "(") { :
missing value where TRUE/FALSE needed

I am attaching the syntax and the data file as a .csv. I am only
passing this along just in case it points to a programming error
somewhere in lavaan.

--Ed Rigdon
Bliemel Adolphs Henseler 2004.csv
Yu et al alternate.R

Shu Fai Cheung (張樹輝)

unread,
Feb 18, 2026, 10:50:37 PM (2 days ago) Feb 18
to lavaan
I am not sure whether this can be considered a bug in lavaan because it depends on the syntax requirements.

In the following lines, the first ends with an operator:

          TANG + RELI + RESP + ASSU + EMPA ~~
             0*e1 + 0*e2 + 0*e3 + 0*e4 + 0*e5 + 0*e6 + 0*e7 + 0*e8 + 0*e9
            +  0*e10 + 0*e11 + 0*e12 + 0*e13 + 0*e14 + 0*e15 + 0*e16 + 0*e17

The error message on parsing the model syntax will disappear if the first line ends with part of the right-hand side of `~~`:

          TANG + RELI + RESP + ASSU + EMPA ~~ 0*e1
            + 0*e2 + 0*e3 + 0*e4 + 0*e5 + 0*e6 + 0*e7 + 0*e8 + 0*e9
            +  0*e10 + 0*e11 + 0*e12 + 0*e13 + 0*e14 + 0*e15 + 0*e16 + 0*e17


Another error message appeared after I made this change, but it seems to be related to the model specification rather than parsing the model syntax.

Hope this helps.

-- Shu Fai

Yves Rosseel

unread,
Feb 19, 2026, 3:40:52 AM (yesterday) Feb 19
to lav...@googlegroups.com
The 'old' parser could handle this, but the 'new' one (currently) not. I
will ask Luc (who wrote the new parser) if we can fix this.

(you can switch to the old parser by using parser = "old")

Yves.
> --
> You received this message because you are subscribed to the Google
> Groups "lavaan" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to lavaan+un...@googlegroups.com
> <mailto:lavaan+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> lavaan/8587588b-d201-4250-871b-bd671cad41aan%40googlegroups.com
> <https://groups.google.com/d/msgid/lavaan/8587588b-d201-4250-871b-
> bd671cad41aan%40googlegroups.com?utm_medium=email&utm_source=footer>.

Edward Rigdon

unread,
Feb 19, 2026, 7:19:27 AM (23 hours ago) Feb 19
to lav...@googlegroups.com
Shu Fai, Yves--
Thank you very kindly for these speedy replies. Rather than
change parser, I will rewrite the syntax so that continuation lines
start with an operator, rather than broken lines ending with an
operator. This is for a guest lecture coming up in a few weeks, so I
think I will share / model syntax that doesn't create a problem. I
have had a nagging feeling about syntax line breaks, but I don't
recall reading it as an actual guideline. I sup[pose it would be best
if the parser had maximum flexibility.
I can't tell you how much I enjoy using this package.
> To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/lavaan/fd9fb985-18f8-41d8-abe0-28a03543fd17%40gmail.com.

Yves Rosseel

unread,
Feb 19, 2026, 8:13:09 AM (22 hours ago) Feb 19
to lav...@googlegroups.com
On 2/19/26 13:19, Edward Rigdon wrote:
> I sup[pose it would be best if the parser had maximum flexibility.

The github version has already fixed this.

Yves.

Edward Rigdon

unread,
Feb 19, 2026, 9:14:53 AM (21 hours ago) Feb 19
to lav...@googlegroups.com
Thank you.
> --
> You received this message because you are subscribed to the Google Groups "lavaan" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/lavaan/93941d87-b759-4ce8-91e4-2d401a7c97f3%40gmail.com.
Reply all
Reply to author
Forward
0 new messages