Skip to content

Commit

Permalink
reducing time of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
larmarange committed Jul 5, 2022
1 parent 5409a74 commit f751ee9
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 71 deletions.
2 changes: 1 addition & 1 deletion R/model_compute_terms_contributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @param model a model object
#' @export
#' @family model_helpers
#' @examples
#' @examplesIf interactive()
#' mod <- lm(Sepal.Length ~ Sepal.Width, iris)
#' mod %>% model_compute_terms_contributions()
#'
Expand Down
2 changes: 1 addition & 1 deletion R/select_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' `c("treatment", "sum", "poly", "helmert", "other")`
#'
#' @return A character vector of column names selected
#' @examples
#' @examplesIf interactive()
#' glm(response ~ age * trt + grade, gtsummary::trial, family = binomial) %>%
#' tidy_plus_plus(exponentiate = TRUE, include = all_categorical())
#'
Expand Down
2 changes: 1 addition & 1 deletion R/tidy_add_header_rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @inheritParams tidy_plus_plus
#' @export
#' @family tidy_helpers
#' @examplesIf .assert_package("gtsummary", boolean = TRUE)
#' @examplesIf .assert_package("gtsummary", boolean = TRUE) & interactive()
#' df <- Titanic %>%
#' dplyr::as_tibble() %>%
#' dplyr::mutate(Survived = factor(Survived, c("No", "Yes")))
Expand Down
2 changes: 1 addition & 1 deletion R/tidy_add_n.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#' @param model the corresponding model, if not attached to `x`
#' @export
#' @family tidy_helpers
#' @examples
#' @examplesIf interactive()
#' lm(Petal.Length ~ ., data = iris) %>%
#' tidy_and_attach() %>%
#' tidy_add_n()
Expand Down
2 changes: 1 addition & 1 deletion R/tidy_add_reference_rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @inheritParams tidy_plus_plus
#' @export
#' @family tidy_helpers
#' @examplesIf .assert_package("gtsummary", boolean = TRUE)
#' @examplesIf .assert_package("gtsummary", boolean = TRUE) & interactive()
#' df <- Titanic %>%
#' dplyr::as_tibble() %>%
#' dplyr::mutate(Survived = factor(Survived, c("No", "Yes")))
Expand Down
2 changes: 1 addition & 1 deletion R/tidy_add_term_labels.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' @inheritParams tidy_plus_plus
#' @export
#' @family tidy_helpers
#' @examples
#' @examplesIf interactive()
#' df <- Titanic %>%
#' dplyr::as_tibble() %>%
#' dplyr::mutate(Survived = factor(Survived, c("No", "Yes"))) %>%
Expand Down
63 changes: 32 additions & 31 deletions R/tidy_plus_plus.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,39 +63,40 @@
#' Class = "Passenger's class",
#' Sex = "Gender"
#' )
#' if (interactive()) {
#' ex2 <- glm(
#' Survived ~ Class + Age * Sex,
#' data = df, weights = df$n,
#' family = binomial
#' ) %>%
#' tidy_plus_plus(
#' exponentiate = TRUE,
#' add_reference_rows = FALSE,
#' categorical_terms_pattern = "{level} / {reference_level}",
#' add_n = TRUE
#' )
#' ex2
#'
#' ex2 <- glm(
#' Survived ~ Class + Age * Sex,
#' data = df, weights = df$n,
#' family = binomial
#' ) %>%
#' tidy_plus_plus(
#' exponentiate = TRUE,
#' add_reference_rows = FALSE,
#' categorical_terms_pattern = "{level} / {reference_level}",
#' add_n = TRUE
#' )
#' ex2
#'
#' ex3 <-
#' glm(
#' response ~ poly(age, 3) + stage + grade * trt,
#' na.omit(gtsummary::trial),
#' family = binomial,
#' contrasts = list(
#' stage = contr.treatment(4, base = 3),
#' grade = contr.sum
#' ex3 <-
#' glm(
#' response ~ poly(age, 3) + stage + grade * trt,
#' na.omit(gtsummary::trial),
#' family = binomial,
#' contrasts = list(
#' stage = contr.treatment(4, base = 3),
#' grade = contr.sum
#' )
#' ) %>%
#' tidy_plus_plus(
#' exponentiate = TRUE,
#' variable_labels = c(age = "Age (in years)"),
#' add_header_rows = TRUE,
#' show_single_row = all_dichotomous(),
#' term_labels = c("poly(age, 3)3" = "Cubic age"),
#' keep_model = TRUE
#' )
#' ) %>%
#' tidy_plus_plus(
#' exponentiate = TRUE,
#' variable_labels = c(age = "Age (in years)"),
#' add_header_rows = TRUE,
#' show_single_row = all_dichotomous(),
#' term_labels = c("poly(age, 3)3" = "Cubic age"),
#' keep_model = TRUE
#' )
#' ex3
#' ex3
#' }
#' @export
tidy_plus_plus <- function(
model,
Expand Down
2 changes: 2 additions & 0 deletions man/model_compute_terms_contributions.Rd

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

2 changes: 2 additions & 0 deletions man/select_helpers.Rd

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

2 changes: 1 addition & 1 deletion man/tidy_add_header_rows.Rd

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

2 changes: 2 additions & 0 deletions man/tidy_add_n.Rd

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

2 changes: 1 addition & 1 deletion man/tidy_add_reference_rows.Rd

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

2 changes: 2 additions & 0 deletions man/tidy_add_term_labels.Rd

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

65 changes: 33 additions & 32 deletions man/tidy_plus_plus.Rd

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

0 comments on commit f751ee9

Please sign in to comment.