Skip to content

Commit

Permalink
compatibility with R 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
larmarange committed Oct 7, 2024
1 parent 6998226 commit 5089e29
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 43 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ License: GPL (>= 3)
URL: https://larmarange.github.io/broom.helpers/, https://github.com/larmarange/broom.helpers
BugReports: https://github.com/larmarange/broom.helpers/issues
Depends:
R (>= 4.2)
R (>= 4.1)
Imports:
broom (>= 0.8),
cards,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- variable labels are now returned by `model_list_variables()` for `svycoxph`
models (#275)
- compatibility with R version 4.1 minimum (#276)

# broom.helpers 1.17.0

Expand Down
11 changes: 5 additions & 6 deletions R/model_identify_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
#' ) |>
#' model_identify_variables()
#'
#' iris |>
#' lm(
#' Sepal.Length ~ poly(Sepal.Width, 2) + Species,
#' data = _,
#' contrasts = list(Species = contr.sum)
#' ) |>
#' lm(
#' Sepal.Length ~ poly(Sepal.Width, 2) + Species,
#' data = iris,
#' contrasts = list(Species = contr.sum)
#' ) |>
#' model_identify_variables()
model_identify_variables <- function(model) {
UseMethod("model_identify_variables")
Expand Down
25 changes: 12 additions & 13 deletions R/model_list_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,19 @@
#' ) |>
#' model_list_variables()
#'
#' iris |>
#' lm(
#' Sepal.Length ~ poly(Sepal.Width, 2) + Species,
#' data = _,
#' contrasts = list(Species = contr.sum)
#' ) |>
#' model_list_variables()
#'
#' glm(
#' response ~ poly(age, 3) + stage + grade * trt,
#' na.omit(gtsummary::trial),
#' family = binomial,
#' lm(
#' Sepal.Length ~ poly(Sepal.Width, 2) + Species,
#' data = iris,
#' contrasts = list(Species = contr.sum)
#' ) |>
#' model_list_variables()
#' model_list_variables()
#'
#' glm(
#' response ~ poly(age, 3) + stage + grade * trt,
#' na.omit(gtsummary::trial),
#' family = binomial,
#' ) |>
#' model_list_variables()
#' }
model_list_variables <- function(model, labels = NULL,
only_variable = FALSE, add_var_type = FALSE) {
Expand Down
11 changes: 5 additions & 6 deletions man/model_identify_variables.Rd

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

25 changes: 12 additions & 13 deletions man/model_list_variables.Rd

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

7 changes: 3 additions & 4 deletions tests/testthat/test-add_term_labels.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,10 @@ test_that("tidy_add_term_labels() works with variables having non standard name"
)
)

res <- gtsummary::trial |>
dplyr::select(response, `age at dx` = age, `drug type` = trt) |>
lm(
res <- lm(
response ~ `age at dx` + `drug type`,
data = _
data = gtsummary::trial |>
dplyr::select(response, `age at dx` = age, `drug type` = trt)
) |>
tidy_and_attach() |>
tidy_add_variable_labels(list(`age at dx` = "AGGGGGGGE")) |>
Expand Down

0 comments on commit 5089e29

Please sign in to comment.