Skip to content

Commit

Permalink
for svycoxph use default
Browse files Browse the repository at this point in the history
fix #275
  • Loading branch information
larmarange committed Sep 26, 2024
1 parent de429ec commit 4cb9d59
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ S3method(model_get_model_frame,default)
S3method(model_get_model_frame,fixest)
S3method(model_get_model_frame,model_fit)
S3method(model_get_model_frame,survreg)
S3method(model_get_model_frame,svycoxph)
S3method(model_get_model_matrix,LORgee)
S3method(model_get_model_matrix,betareg)
S3method(model_get_model_matrix,biglm)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# broom.helpers (development version)

**Fixes**

- variable labels are now returned by `model_list_variables()` for `svycoxph`
models (#275)

# broom.helpers 1.17.0

**Deprecated functions and changes in selectors functions**
Expand Down
4 changes: 4 additions & 0 deletions R/model_get_model_frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ model_get_model_frame.coxph <- function(model) {
res
}

#' @export
#' @rdname model_get_model_frame
model_get_model_frame.svycoxph <- model_get_model_frame.default

#' @export
#' @rdname model_get_model_frame
model_get_model_frame.survreg <- function(model) {
Expand Down
3 changes: 3 additions & 0 deletions man/model_get_model_frame.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion tests/testthat/test-tidy_plus_plus.R
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ test_that("tidy_plus_plus() works with survey::svyglm", {
test_that("tidy_plus_plus() works with survey::svycoxph", {
skip_on_cran()
skip_if_not_installed("survey")
dpbc <- survey::svydesign(id = ~1, prob = ~1, strata = ~edema, data = survival::pbc)
skip_if_not_installed("labelled")
d <- survival::pbc
labelled::var_label(d$albumin) <- "Custom label"
dpbc <- survey::svydesign(id = ~1, prob = ~1, strata = ~edema, data = d)
mod <- survey::svycoxph(
Surv(time, status > 0) ~ log(bili) + protime + albumin,
design = dpbc
Expand All @@ -340,6 +343,10 @@ test_that("tidy_plus_plus() works with survey::svycoxph", {
res <- mod |> tidy_plus_plus(),
NA
)
expect_equivalent(
res[res$term == "albumin", "var_label"][[1]][1],
"Custom label"
)
})

test_that("tidy_plus_plus() works with survey::svyolr", {
Expand Down

0 comments on commit 4cb9d59

Please sign in to comment.