Skip to content

Commit

Permalink
fix partial matching
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 27, 2024
1 parent 50c5e0a commit b15df1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions R/n_clusters_easystats.R
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,6 @@ plot.n_clusters_dbscan <- plot.n_clusters_elbow
#' @export
plot.n_clusters_hclust <- function(x, ...) {
insight::check_if_installed("pvclust")
graphics::plot(attributes(x)$model)
pvclust::pvrect(attributes(x)$model, alpha = attributes(x)$ci, pv = "si")
graphics::plot(attributes(x)[["model"]])
pvclust::pvrect(attributes(x)[["model"]], alpha = attributes(x)$ci, pv = "si")
}
8 changes: 4 additions & 4 deletions R/utils_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -954,16 +954,16 @@
}

# fix column output
if (inherits(attributes(x)$model, c("lavaan", "blavaan")) && "Label" %in% colnames(x)) {
if (inherits(attributes(x)[["model"]], c("lavaan", "blavaan")) && "Label" %in% colnames(x)) {
x$From <- ifelse(!nzchar(as.character(x$Label), keepNA = TRUE) | x$Label == x$To, x$From, paste0(x$From, " (", x$Label, ")")) # nolint
x$Label <- NULL
}

if (inherits(attributes(x)$model, c("lavaan", "blavaan")) && !"Parameter" %in% colnames(x)) {
if (inherits(attributes(x)[["model"]], c("lavaan", "blavaan")) && !"Parameter" %in% colnames(x)) {
parameter_column <- colnames(x)[1]
}

if (inherits(attributes(x)$model, c("lavaan", "blavaan")) && "Defined" %in% x$Component) {
if (inherits(attributes(x)[["model"]], c("lavaan", "blavaan")) && "Defined" %in% x$Component) {
x$From[x$Component == "Defined"] <- ""
x$Operator[x$Component == "Defined"] <- ""
x$To <- ifelse(x$Component == "Defined", paste0("(", x$To, ")"), x$To)
Expand Down Expand Up @@ -1175,7 +1175,7 @@
# fix non-equal length of columns
final_table <- .fix_nonmatching_columns(
final_table,
is_lavaan = inherits(attributes(x)$model, c("lavaan", "blavaan"))
is_lavaan = inherits(attributes(x)[["model"]], c("lavaan", "blavaan"))
)
do.call(rbind, final_table)
} else {
Expand Down

0 comments on commit b15df1b

Please sign in to comment.