Skip to content

" Error in if (str_detect(var, "\\*")) { : missing value where TRUE/FALSE needed #18

@shoutjoy

Description

@shoutjoy

It could be a minor issue.
When I write Equation to use drawModel, I get an error if I don't put it in the first line.

error Form
equation=' # An error occurs when one line goes down in this section. M1~X M2~X+M1 M3~X+M1 Y~X+M1+M2+M3' node.pos=list(X=c(0,0.5),M1=c(0.5,0.5),M2=c(0.75,0.9),M3=c(0.75,0.1),Y=c(1,0.5)) curved.arrow=list(a2=-0.1,a3=0.1,c=-0.15) drawModel(equation=equation,nodemode=2,node.pos=node.pos,curved.arrow=curved.arrow)

If you write one space down after the quotation marks, a warning message appears.

equation="
M1X
M2
X+M1
M3X+M1
Y
X+M1+M2+M3'
"

'drawModel(equation=equation,nodemode=2,node.pos=node.pos,curved.arrow=curved.arrow)'
Warning Message
"Error in if (str_detect(var, "\*")) { :
missing value where TRUE/FALSE needed"

No error Form : It should be written directly in quotation marks as shown below.
equation='M1~X M2~X+M1 M3~X+M1 Y~X+M1+M2+M3'

equation='M1X
M2
X+M1
M3X+M1
Y
X+M1+M2+M3'

When using lavaan package , there seems to be more flexibility in this area.
It's not an error, but it's likely to be a user error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions