Skip to content

Commit f751ee9

Browse files
committed
reducing time of examples
1 parent 5409a74 commit f751ee9

14 files changed

+81
-71
lines changed

R/model_compute_terms_contributions.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#' @param model a model object
1313
#' @export
1414
#' @family model_helpers
15-
#' @examples
15+
#' @examplesIf interactive()
1616
#' mod <- lm(Sepal.Length ~ Sepal.Width, iris)
1717
#' mod %>% model_compute_terms_contributions()
1818
#'

R/select_helpers.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' `c("treatment", "sum", "poly", "helmert", "other")`
2222
#'
2323
#' @return A character vector of column names selected
24-
#' @examples
24+
#' @examplesIf interactive()
2525
#' glm(response ~ age * trt + grade, gtsummary::trial, family = binomial) %>%
2626
#' tidy_plus_plus(exponentiate = TRUE, include = all_categorical())
2727
#'

R/tidy_add_header_rows.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @inheritParams tidy_plus_plus
2828
#' @export
2929
#' @family tidy_helpers
30-
#' @examplesIf .assert_package("gtsummary", boolean = TRUE)
30+
#' @examplesIf .assert_package("gtsummary", boolean = TRUE) & interactive()
3131
#' df <- Titanic %>%
3232
#' dplyr::as_tibble() %>%
3333
#' dplyr::mutate(Survived = factor(Survived, c("No", "Yes")))

R/tidy_add_n.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#' @param model the corresponding model, if not attached to `x`
6161
#' @export
6262
#' @family tidy_helpers
63-
#' @examples
63+
#' @examplesIf interactive()
6464
#' lm(Petal.Length ~ ., data = iris) %>%
6565
#' tidy_and_attach() %>%
6666
#' tidy_add_n()

R/tidy_add_reference_rows.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @inheritParams tidy_plus_plus
2828
#' @export
2929
#' @family tidy_helpers
30-
#' @examplesIf .assert_package("gtsummary", boolean = TRUE)
30+
#' @examplesIf .assert_package("gtsummary", boolean = TRUE) & interactive()
3131
#' df <- Titanic %>%
3232
#' dplyr::as_tibble() %>%
3333
#' dplyr::mutate(Survived = factor(Survived, c("No", "Yes")))

R/tidy_add_term_labels.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @inheritParams tidy_plus_plus
2828
#' @export
2929
#' @family tidy_helpers
30-
#' @examples
30+
#' @examplesIf interactive()
3131
#' df <- Titanic %>%
3232
#' dplyr::as_tibble() %>%
3333
#' dplyr::mutate(Survived = factor(Survived, c("No", "Yes"))) %>%

R/tidy_plus_plus.R

+32-31
Original file line numberDiff line numberDiff line change
@@ -63,39 +63,40 @@
6363
#' Class = "Passenger's class",
6464
#' Sex = "Gender"
6565
#' )
66+
#' if (interactive()) {
67+
#' ex2 <- glm(
68+
#' Survived ~ Class + Age * Sex,
69+
#' data = df, weights = df$n,
70+
#' family = binomial
71+
#' ) %>%
72+
#' tidy_plus_plus(
73+
#' exponentiate = TRUE,
74+
#' add_reference_rows = FALSE,
75+
#' categorical_terms_pattern = "{level} / {reference_level}",
76+
#' add_n = TRUE
77+
#' )
78+
#' ex2
6679
#'
67-
#' ex2 <- glm(
68-
#' Survived ~ Class + Age * Sex,
69-
#' data = df, weights = df$n,
70-
#' family = binomial
71-
#' ) %>%
72-
#' tidy_plus_plus(
73-
#' exponentiate = TRUE,
74-
#' add_reference_rows = FALSE,
75-
#' categorical_terms_pattern = "{level} / {reference_level}",
76-
#' add_n = TRUE
77-
#' )
78-
#' ex2
79-
#'
80-
#' ex3 <-
81-
#' glm(
82-
#' response ~ poly(age, 3) + stage + grade * trt,
83-
#' na.omit(gtsummary::trial),
84-
#' family = binomial,
85-
#' contrasts = list(
86-
#' stage = contr.treatment(4, base = 3),
87-
#' grade = contr.sum
80+
#' ex3 <-
81+
#' glm(
82+
#' response ~ poly(age, 3) + stage + grade * trt,
83+
#' na.omit(gtsummary::trial),
84+
#' family = binomial,
85+
#' contrasts = list(
86+
#' stage = contr.treatment(4, base = 3),
87+
#' grade = contr.sum
88+
#' )
89+
#' ) %>%
90+
#' tidy_plus_plus(
91+
#' exponentiate = TRUE,
92+
#' variable_labels = c(age = "Age (in years)"),
93+
#' add_header_rows = TRUE,
94+
#' show_single_row = all_dichotomous(),
95+
#' term_labels = c("poly(age, 3)3" = "Cubic age"),
96+
#' keep_model = TRUE
8897
#' )
89-
#' ) %>%
90-
#' tidy_plus_plus(
91-
#' exponentiate = TRUE,
92-
#' variable_labels = c(age = "Age (in years)"),
93-
#' add_header_rows = TRUE,
94-
#' show_single_row = all_dichotomous(),
95-
#' term_labels = c("poly(age, 3)3" = "Cubic age"),
96-
#' keep_model = TRUE
97-
#' )
98-
#' ex3
98+
#' ex3
99+
#' }
99100
#' @export
100101
tidy_plus_plus <- function(
101102
model,

man/model_compute_terms_contributions.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/select_helpers.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidy_add_header_rows.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidy_add_n.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidy_add_reference_rows.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidy_add_term_labels.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidy_plus_plus.Rd

+33-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)