Skip to content

Commit

Permalink
id column name bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-jedrusiak committed Jun 1, 2023
1 parent b1be97f commit a3d4bc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/mtscr_model_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mtscr_model_summary <- function(model) {
purrr::map(
model,
\(x) {
st <- glmmTMB::VarCorr(x)[1]$cond$id[1]
st <- glmmTMB::VarCorr(x)[1]$cond[[1]][1]
diag_cov <- x$sdr$diag.cov.random
se <- diag_cov[seq(1, length(diag_cov) / 2)] |>
mean()
Expand Down
6 changes: 3 additions & 3 deletions R/mtscr_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ mtscr_score <- function(df, id_column, item_column = NULL, score_column, top = 1
\(current_model, top_number) {
col_name <- paste0(".creativity_score_top", top_number)

glmmTMB::ranef(current_model)$cond$id |>
dplyr::as_tibble(rownames = "id") |>
dplyr::select("id", !!col_name := "(Intercept)")
glmmTMB::ranef(current_model)$cond[[rlang::as_label(id_column)]] |>
dplyr::as_tibble(rownames = rlang::as_label(id_column)) |>
dplyr::select(!!id_column, !!col_name := "(Intercept)")
}
) |>
Reduce(dplyr::full_join, x = _) |>
Expand Down

0 comments on commit a3d4bc3

Please sign in to comment.