ecmerkle / blavaan

An R package for Bayesian structural equation modeling
https://ecmerkle.github.io/blavaan
87 stars 23 forks source link

error in help-page examples for wrappers #78

Closed TDJorgensen closed 6 months ago

TDJorgensen commented 7 months ago

Is length() the right function here?

if(length(mc$model.type) == 3L) mc$model.type <- mc$model.type[3L]

The ?bcfa help-page example leads to this error:

invalid value in model.type option: "bcfa"

And likewise for the ?bsem help-page example.

I can't tell if you are trying to detect bsem or bcfa as the called function, then remove the "b" to assign the model.type=. Perhaps nchar() works? But this code exists only within the equivalent bcfa() and bsem() functions, so you already know it is one of those 2 calls. I would just remove the first character:

mc$model.type <- strsplit(mc$model.type, split = "b")[[1]][2]

Or just check if (mc$model.type == "bcfa") (or "bsem") to assign the right string.

ecmerkle commented 7 months ago

I inherited that line from lavaan, I think at the start of blavaan. For example, you can find it in lavaan here. I am not sure about the intent, and xxx_lavaan.R is totally different now, so some change is probably needed.

Are you getting this error with lavaan from github? (newer than 0.6-17?)

TDJorgensen commented 7 months ago

Yes, lavaan_0.6-18.2090 and blavaan_0.5-4