From dfd8d4e9b446c2d45ee621cf5ceca7f75498c4e8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 21 Sep 2023 17:54:35 +0200 Subject: [PATCH] fix RD --- R/compare_parameters.R | 2 +- R/print.parameters_model.R | 26 ++++++++++++-------------- man/compare_parameters.Rd | 2 ++ man/print.parameters_model.Rd | 26 +++++++++++++------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/R/compare_parameters.R b/R/compare_parameters.R index d93b0d209..203d10915 100644 --- a/R/compare_parameters.R +++ b/R/compare_parameters.R @@ -32,7 +32,7 @@ #' #' @return A data frame of indices related to the model's parameters. #' -#' @examples +#' @examplesIf require("gt", quietly = TRUE) #' data(iris) #' lm1 <- lm(Sepal.Length ~ Species, data = iris) #' lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) diff --git a/R/print.parameters_model.R b/R/print.parameters_model.R index 6916275c2..b707ed422 100644 --- a/R/print.parameters_model.R +++ b/R/print.parameters_model.R @@ -146,26 +146,24 @@ #' [`print_md()`][print_md.parameters_model]. See also #' [`display()`][display.parameters_model]. #' -#' @examples +#' @examplesIf require("gt", quietly = TRUE) && require("glmmTMB", quietly = TRUE) #' \donttest{ #' library(parameters) -#' if (require("glmmTMB", quietly = TRUE)) { -#' model <- glmmTMB( -#' count ~ spp + mined + (1 | site), -#' ziformula = ~mined, -#' family = poisson(), -#' data = Salamanders -#' ) -#' mp <- model_parameters(model) +#' model <- glmmTMB::glmmTMB( +#' count ~ spp + mined + (1 | site), +#' ziformula = ~mined, +#' family = poisson(), +#' data = Salamanders +#' ) +#' mp <- model_parameters(model) #' -#' print(mp, pretty_names = FALSE) +#' print(mp, pretty_names = FALSE) #' -#' print(mp, split_components = FALSE) +#' print(mp, split_components = FALSE) #' -#' print(mp, select = c("Parameter", "Coefficient", "SE")) +#' print(mp, select = c("Parameter", "Coefficient", "SE")) #' -#' print(mp, select = "minimal") -#' } +#' print(mp, select = "minimal") #' #' #' # group parameters ------ diff --git a/man/compare_parameters.Rd b/man/compare_parameters.Rd index 0c7e6f764..894f830da 100644 --- a/man/compare_parameters.Rd +++ b/man/compare_parameters.Rd @@ -190,6 +190,7 @@ Therefore, you should not use this function to compare models with interaction terms with models without interaction terms. } \examples{ +\dontshow{if (require("gt", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) @@ -220,4 +221,5 @@ compare_parameters(m1, m2, column_names = c("linear model", "logistic reg.")) compare_parameters(list(m1, m2)) compare_parameters(list("linear model" = m1, "logistic reg." = m2)) } +\dontshow{\}) # examplesIf} } diff --git a/man/print.parameters_model.Rd b/man/print.parameters_model.Rd index 40655441e..5b602b1d9 100644 --- a/man/print.parameters_model.Rd +++ b/man/print.parameters_model.Rd @@ -218,25 +218,24 @@ freedom. } \examples{ +\dontshow{if (require("gt", quietly = TRUE) && require("glmmTMB", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ library(parameters) -if (require("glmmTMB", quietly = TRUE)) { - model <- glmmTMB( - count ~ spp + mined + (1 | site), - ziformula = ~mined, - family = poisson(), - data = Salamanders - ) - mp <- model_parameters(model) +model <- glmmTMB::glmmTMB( + count ~ spp + mined + (1 | site), + ziformula = ~mined, + family = poisson(), + data = Salamanders +) +mp <- model_parameters(model) - print(mp, pretty_names = FALSE) +print(mp, pretty_names = FALSE) - print(mp, split_components = FALSE) +print(mp, split_components = FALSE) - print(mp, select = c("Parameter", "Coefficient", "SE")) +print(mp, select = c("Parameter", "Coefficient", "SE")) - print(mp, select = "minimal") -} +print(mp, select = "minimal") # group parameters ------ @@ -292,6 +291,7 @@ print(result) result <- compare_parameters(lm1, lm2, select = "{estimate}
({se})|{p}") print_html(result) } +\dontshow{\}) # examplesIf} } \seealso{ There is a dedicated method to use inside rmarkdown files,