Skip to content

Commit

Permalink
Merge pull request #168 from etiennebacher/speedup
Browse files Browse the repository at this point in the history
Some speedup
  • Loading branch information
gergness authored Jul 14, 2024
2 parents 5aea29a + 9cea023 commit f0c5b5e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/survey_statistics_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set_survey_vars <- function(
out$phase1$sample$variables[[name]] <- x
} else {
if (!add) {
out$variables <- select(out$variables, dplyr::one_of(group_vars(out)))
out$variables <- out$variables[, group_vars(out), drop = FALSE]
}
out$variables[[name]] <- x
}
Expand Down Expand Up @@ -83,7 +83,7 @@ get_var_est <- function(
se <- survey::SE(stat)
# Needed for grouped quantile
if (!inherits(se, "data.frame")) {
se <- data.frame(matrix(se, ncol = out_width))
se <- as.data.frame(se)
}
names(se) <- "_se"
se
Expand Down Expand Up @@ -122,7 +122,7 @@ get_var_est <- function(
}
})

coef <- data.frame(matrix(coef(stat), ncol = out_width))
coef <- as.data.frame(unclass(coef(stat)))
names(coef) <- "coef"
out <- c(list(coef), out)

Expand All @@ -136,7 +136,7 @@ get_var_est <- function(
out <- c(out, list(deff))
}

as_srvyr_result_df(dplyr::bind_cols(out))
as_srvyr_result_df(do.call(cbind, out))
}

# Largely the same as get_var_est(), but need to handle the fact that there can be
Expand Down

0 comments on commit f0c5b5e

Please sign in to comment.