cardiomoon / processR

52 stars 10 forks source link

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

Open shoutjoy opened 2 years ago

shoutjoy commented 2 years ago

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=" M1~X M2~X+M1 M3~X+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='M1~X M2~X+M1 M3~X+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.