Removed duplicate parameters of lavaan models with equality constraints from plot.semtree - #97
Removed duplicate parameters of lavaan models with equality constraints from plot.semtree#97manuelarnold wants to merge 2 commits into
Conversation
…ts from plot.semtree
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 722f9f1d27
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (inherits(x$model, "lavaan")) { | ||
| param <- x$params[!duplicated(names(x$params))] | ||
| param_names <- names(param) | ||
| param_values <- round(unique(param), digits = 3) |
There was a problem hiding this comment.
Keep parameter values aligned with names
Using unique(param) deduplicates by value, not by name, so in lavaan models where different parameters share the same estimate, param_values becomes shorter than param_names. This misaligns or drops entries in leaf_text because paste(param_names, "=", param_values) will recycle or truncate values, producing incorrect parameter/value pairs for terminal nodes. Using the already name-deduped param (e.g., unname(param)) avoids collapsing equal-valued parameters.
Useful? React with 👍 / 👎.
No description provided.