From db9cb3bd7ef37a4a6eba289111e2e2e0f502837f Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Mon, 11 Oct 2021 10:37:26 -0400 Subject: [PATCH 01/11] bump version, note revdeps --- DESCRIPTION | 2 +- NEWS.md | 2 +- cran-comments.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 32c7267a5..132ee22c0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: broom Title: Convert Statistical Objects into Tidy Tibbles -Version: 0.7.9.9001 +Version: 0.7.10 Authors@R: c(person(given = "David", family = "Robinson", diff --git a/NEWS.md b/NEWS.md index 97f15b80e..0ee9e89e0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# broom 0.7.9.9001 +# broom 0.7.10 To be released as broom 0.7.10. diff --git a/cran-comments.md b/cran-comments.md index be4694452..ed773cb27 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,4 +1,4 @@ -# broom 0.7.9 +# broom 0.7.10 ## Test environments @@ -14,6 +14,6 @@ # Reverse dependencies -We checked 190 reverse dependencies (175 from CRAN + 15 from BioConductor), +We checked 196 reverse dependencies (179 from CRAN + 17 from BioConductor), comparing R CMD check results across CRAN and dev versions of this package. We saw no new ERRORs, WARNINGs, or NOTEs. From 58ad1b4a25fd04ce37409132982847baf2a82d70 Mon Sep 17 00:00:00 2001 From: Greg Macfarlane Date: Mon, 11 Oct 2021 10:15:28 -0600 Subject: [PATCH 02/11] Add residuals to augment.mlogit, close #1055 --- R/mlogit-tidiers.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/mlogit-tidiers.R b/R/mlogit-tidiers.R index 4ca1ff65e..3d0f0fcef 100644 --- a/R/mlogit-tidiers.R +++ b/R/mlogit-tidiers.R @@ -82,6 +82,7 @@ augment.mlogit <- function(x, data = x$model, ...) { dplyr::mutate( id = idx$id1, alternative = idx$id2, + .resid = as.vector(x$residuals) ) %>% dplyr::select(id, alternative, chosen, everything()) From 1c39add68dd51d47b24f95e8dadecdf12e336bba Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Mon, 11 Oct 2021 18:57:12 -0400 Subject: [PATCH 03/11] document addition of `.resid` to `augment.mlogit` output in NEWS --- NEWS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 0ee9e89e0..257a0c19a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,7 +6,9 @@ To be released as broom 0.7.10. * Allows user to specify confidence level for `tidy.rma` (`#1041` by `@TarenSanders`) * Clarifies documentation related to usage of `augment_columns()`; most package users should use `augment()` in favor of `augment_columns()`. See `?augment_columns` for more details. * Extends support for `emmeans` by fixing non-standard column names in case of asymptotically derived inferential statistics. (`#1046` by `@crsh`) -* Fixes use of index columns in `augment.mlogit`. (`#1045` and `#1053` by `@jamesrrae` and `@gregmacfarlane`) +* Fixes use of index columns in `augment.mlogit` and adds `.resid` column to +output. (`#1045`, `#1053`, `#1055`, and `#1056` by `@jamesrrae` and +`@gregmacfarlane`) * Correct column naming of standard error measures in `glance.survfit()`. * Various bug fixes and improvements to documentation. From ea1194bbd42561cb28c3abf38732a75d7ea55b11 Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Mon, 11 Oct 2021 19:56:45 -0400 Subject: [PATCH 04/11] drop failing URL --- R/mass-polr-tidiers.R | 3 +-- man/tidy.polr.Rd | 3 +-- man/tidy.svyolr.Rd | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/R/mass-polr-tidiers.R b/R/mass-polr-tidiers.R index 71cffccf1..2b62786f2 100644 --- a/R/mass-polr-tidiers.R +++ b/R/mass-polr-tidiers.R @@ -29,8 +29,7 @@ #' are `coefficient` and `scale`, rather than `coefficient` and `zeta`. #' #' Calculating p.values with the `dropterm()` function is the approach -#' suggested by the MASS package author -#' \url{https://r.789695.n4.nabble.com/p-values-of-plor-td4668100.html}. This +#' suggested by the MASS package author. This #' approach is computationally intensive so that p.values are only #' returned if requested explicitly. Additionally, it only works for #' models containing no variables with more than two categories. If this diff --git a/man/tidy.polr.Rd b/man/tidy.polr.Rd index 69b77b4f6..aa2187356 100644 --- a/man/tidy.polr.Rd +++ b/man/tidy.polr.Rd @@ -56,8 +56,7 @@ In \verb{broom 0.7.0} the \code{coefficient_type} column was renamed to are \code{coefficient} and \code{scale}, rather than \code{coefficient} and \code{zeta}. Calculating p.values with the \code{dropterm()} function is the approach -suggested by the MASS package author -\url{https://r.789695.n4.nabble.com/p-values-of-plor-td4668100.html}. This +suggested by the MASS package author. This approach is computationally intensive so that p.values are only returned if requested explicitly. Additionally, it only works for models containing no variables with more than two categories. If this diff --git a/man/tidy.svyolr.Rd b/man/tidy.svyolr.Rd index 1701e62fd..900ff2254 100644 --- a/man/tidy.svyolr.Rd +++ b/man/tidy.svyolr.Rd @@ -56,8 +56,7 @@ In \verb{broom 0.7.0} the \code{coefficient_type} column was renamed to are \code{coefficient} and \code{scale}, rather than \code{coefficient} and \code{zeta}. Calculating p.values with the \code{dropterm()} function is the approach -suggested by the MASS package author -\url{https://r.789695.n4.nabble.com/p-values-of-plor-td4668100.html}. This +suggested by the MASS package author. This approach is computationally intensive so that p.values are only returned if requested explicitly. Additionally, it only works for models containing no variables with more than two categories. If this From 8af1ec4e3ea677b379bafbb24c946ddcc62aecb5 Mon Sep 17 00:00:00 2001 From: gravesti <83659704+gravesti@users.noreply.github.com> Date: Fri, 15 Oct 2021 16:01:13 +0200 Subject: [PATCH 05/11] warn_on_glm2 check for character Check x$method is a character before testing if it equals "glm.fit2" otherwise functions will cause errors --- R/stats-glm-tidiers.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/stats-glm-tidiers.R b/R/stats-glm-tidiers.R index 339d2e6e5..cb5ab574a 100644 --- a/R/stats-glm-tidiers.R +++ b/R/stats-glm-tidiers.R @@ -162,7 +162,7 @@ warn_on_appropriated_glm_class <- function(x) { # by stats::glm2. glm2 outputs are currently not supported (intentionally) # so warn that output is not maintained. warn_on_glm2 <- function(x) { - if (!is.null(x$method)) { + if (!is.null(x$method) & is.character(x$method)) { if (x$method == "glm.fit2") { warning("The supplied model object seems to be outputted from the glm2 ", "package. Tidiers for glm2 output are currently not ", From 6dce9daf01c286d0a95aa468b42eda4f858398da Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Sat, 16 Oct 2021 19:37:24 -0400 Subject: [PATCH 06/11] run `mclust` examples conditionally --- R/mclust-tidiers.R | 4 +++- man/augment.Mclust.Rd | 2 ++ man/glance.Mclust.Rd | 2 ++ man/tidy.Mclust.Rd | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/R/mclust-tidiers.R b/R/mclust-tidiers.R index f64af284e..f3c7d6d3c 100644 --- a/R/mclust-tidiers.R +++ b/R/mclust-tidiers.R @@ -17,7 +17,8 @@ #' ) #' #' @examples -#' +#' +#' if (requireNamespace("mclust", quietly = TRUE)) { #' library(dplyr) #' library(mclust) #' set.seed(27) @@ -42,6 +43,7 @@ #' tidy(m) #' augment(m, points) #' glance(m) +#' } #' @export #' @aliases mclust_tidiers #' @seealso [tidy()], [mclust::Mclust()] diff --git a/man/augment.Mclust.Rd b/man/augment.Mclust.Rd index d8fede590..382e33e07 100644 --- a/man/augment.Mclust.Rd +++ b/man/augment.Mclust.Rd @@ -70,6 +70,7 @@ missing at this time. } \examples{ +if (requireNamespace("mclust", quietly = TRUE)) { library(dplyr) library(mclust) set.seed(27) @@ -95,6 +96,7 @@ tidy(m) augment(m, points) glance(m) } +} \seealso{ \code{\link[=augment]{augment()}}, \code{\link[mclust:Mclust]{mclust::Mclust()}} diff --git a/man/glance.Mclust.Rd b/man/glance.Mclust.Rd index 02b56a761..94338b817 100644 --- a/man/glance.Mclust.Rd +++ b/man/glance.Mclust.Rd @@ -41,6 +41,7 @@ of the appropriate type. } \examples{ +if (requireNamespace("mclust", quietly = TRUE)) { library(dplyr) library(mclust) set.seed(27) @@ -66,6 +67,7 @@ tidy(m) augment(m, points) glance(m) } +} \value{ A \code{\link[tibble:tibble]{tibble::tibble()}} with exactly one row and columns: \item{BIC}{Bayesian Information Criterion for the model.} diff --git a/man/tidy.Mclust.Rd b/man/tidy.Mclust.Rd index a0ba5b202..0b685fb5a 100644 --- a/man/tidy.Mclust.Rd +++ b/man/tidy.Mclust.Rd @@ -30,6 +30,7 @@ specify which components to return. } \examples{ +if (requireNamespace("mclust", quietly = TRUE)) { library(dplyr) library(mclust) set.seed(27) @@ -55,6 +56,7 @@ tidy(m) augment(m, points) glance(m) } +} \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[mclust:Mclust]{mclust::Mclust()}} From 377a2d9629c0907b2eb1c906614e334c1eb92626 Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Tue, 19 Oct 2021 15:11:16 -0400 Subject: [PATCH 07/11] requireNamespace suggested packages in examples --- R/aer-tidiers.R | 7 ++++++- R/auc-tidiers.R | 5 +++++ R/bbmle-tidiers.R | 5 +++++ R/betareg-tidiers.R | 5 +++++ R/bingroup-tidiers.R | 17 ++++++++++++++++- R/boot-tidiers.R | 5 +++++ R/car-tidiers.R | 5 +++++ R/caret-tidiers.R | 5 +++++ R/cmprsk-tidiers.R | 4 ++++ R/drc-tidiers.R | 5 +++++ R/emmeans-tidiers.R | 5 +++++ R/epiR-tidiers.R | 4 ++++ R/ergm-tidiers.R | 4 ++++ R/fixest-tidiers.R | 5 +++++ R/gam-tidiers.R | 5 +++++ R/geepack-tidiers.R | 5 +++++ R/glmnet-cv-glmnet-tidiers.R | 5 +++++ R/glmnet-glmnet-tidiers.R | 5 +++++ R/gmm-tidiers.R | 5 +++++ R/hmisc-tidiers.R | 5 +++++ R/joinerml-tidiers.R | 4 ++++ R/kendall-tidiers.R | 6 ++++++ R/ks-tidiers.R | 5 +++++ R/lavaan-tidiers.R | 5 +++++ R/leaps.R | 5 +++++ R/list-svd-tidiers.R | 5 +++++ R/lm-beta-tidiers.R | 5 +++++ R/lmodel2-tidiers.R | 5 +++++ R/lmtest-tidiers.R | 5 +++++ R/maps-tidiers.R | 5 +++++ R/margins-tidiers.R | 6 ++++++ R/mass-fitdistr-tidiers.R | 5 +++++ R/mass-negbin-tidiers.R | 5 +++++ R/mass-polr-tidiers.R | 4 ++++ R/mass-ridgelm-tidiers.R | 6 ++++++ R/mass-rlm-tidiers.R | 4 ++++ R/mclust-tidiers.R | 3 +++ R/mediate-tidiers.R | 6 ++++++ R/mfx-tidiers.R | 7 +++++++ R/mgcv-tidiers.R | 5 +++++ R/mlogit-tidiers.R | 5 +++++ R/muhaz-tidiers.R | 8 ++++++++ R/multcomp-tidiers.R | 5 +++++ R/nnet-tidiers.R | 5 +++++ R/orcutt-tidiers.R | 5 +++++ R/ordinal-clm-tidiers.R | 5 +++++ R/ordinal-clmm-tidiers.R | 5 +++++ R/polca-tidiers.R | 5 +++++ R/psych-tidiers.R | 5 +++++ R/rma-tidiers.R | 5 +++++ R/spdep-tidiers.R | 5 +++++ R/speedglm-speedglm-tidiers.R | 5 +++++ R/speedglm-speedlm-tidiers.R | 5 +++++ R/survey-tidiers.R | 5 +++++ R/survival-aareg-tidiers.R | 5 +++++ R/survival-cch-tidiers.R | 5 +++++ R/survival-coxph-tidiers.R | 5 +++++ R/survival-pyears-tidiers.R | 5 +++++ R/survival-survdiff-tidiers.R | 5 +++++ R/survival-survexp-tidiers.R | 5 +++++ R/survival-survfit-tidiers.R | 5 +++++ R/survival-survreg-tidiers.R | 5 +++++ R/systemfit-tidiers.R | 5 +++++ R/tseries-tidiers.R | 5 +++++ R/vars-tidiers.R | 6 ++++++ R/zoo-tidiers.R | 5 +++++ man/augment.Mclust.Rd | 3 +++ man/augment.betareg.Rd | 5 +++++ man/augment.clm.Rd | 5 +++++ man/augment.coxph.Rd | 5 +++++ man/augment.drc.Rd | 5 +++++ man/augment.fixest.Rd | 5 +++++ man/augment.gam.Rd | 5 +++++ man/augment.ivreg.Rd | 5 +++++ man/augment.mfx.Rd | 7 +++++++ man/augment.mjoint.Rd | 4 ++++ man/augment.mlogit.Rd | 5 +++++ man/augment.poLCA.Rd | 5 +++++ man/augment.polr.Rd | 4 ++++ man/augment.rlm.Rd | 4 ++++ man/augment.sarlm.Rd | 5 +++++ man/augment.speedlm.Rd | 5 +++++ man/augment.survreg.Rd | 5 +++++ man/durbinWatsonTest_tidiers.Rd | 5 +++++ man/glance.Mclust.Rd | 3 +++ man/glance.aareg.Rd | 5 +++++ man/glance.betareg.Rd | 5 +++++ man/glance.binDesign.Rd | 5 +++++ man/glance.cch.Rd | 5 +++++ man/glance.clm.Rd | 5 +++++ man/glance.clmm.Rd | 5 +++++ man/glance.coeftest.Rd | 5 +++++ man/glance.coxph.Rd | 5 +++++ man/glance.crr.Rd | 4 ++++ man/glance.cv.glmnet.Rd | 5 +++++ man/glance.drc.Rd | 5 +++++ man/glance.fitdistr.Rd | 5 +++++ man/glance.fixest.Rd | 5 +++++ man/glance.gam.Rd | 5 +++++ man/glance.geeglm.Rd | 5 +++++ man/glance.glmnet.Rd | 5 +++++ man/glance.gmm.Rd | 5 +++++ man/glance.ivreg.Rd | 5 +++++ man/glance.lmodel2.Rd | 5 +++++ man/glance.margins.Rd | 6 ++++++ man/glance.mfx.Rd | 7 +++++++ man/glance.mjoint.Rd | 4 ++++ man/glance.mlogit.Rd | 5 +++++ man/glance.muhaz.Rd | 8 ++++++++ man/glance.multinom.Rd | 5 +++++ man/glance.negbin.Rd | 5 +++++ man/glance.orcutt.Rd | 5 +++++ man/glance.poLCA.Rd | 5 +++++ man/glance.polr.Rd | 4 ++++ man/glance.pyears.Rd | 5 +++++ man/glance.ridgelm.Rd | 6 ++++++ man/glance.rlm.Rd | 4 ++++ man/glance.sarlm.Rd | 5 +++++ man/glance.speedglm.Rd | 5 +++++ man/glance.speedlm.Rd | 5 +++++ man/glance.survdiff.Rd | 5 +++++ man/glance.survexp.Rd | 5 +++++ man/glance.survfit.Rd | 5 +++++ man/glance.survreg.Rd | 5 +++++ man/glance.svyolr.Rd | 5 +++++ man/glance.varest.Rd | 6 ++++++ man/metafor_tidiers.Rd | 5 +++++ man/tidy.Kendall.Rd | 6 ++++++ man/tidy.Mclust.Rd | 3 +++ man/tidy.aareg.Rd | 5 +++++ man/tidy.betareg.Rd | 5 +++++ man/tidy.binDesign.Rd | 5 +++++ man/tidy.binWidth.Rd | 5 +++++ man/tidy.boot.Rd | 5 +++++ man/tidy.cch.Rd | 5 +++++ man/tidy.cld.Rd | 5 +++++ man/tidy.clm.Rd | 5 +++++ man/tidy.clmm.Rd | 5 +++++ man/tidy.coeftest.Rd | 5 +++++ man/tidy.confint.glht.Rd | 5 +++++ man/tidy.confusionMatrix.Rd | 5 +++++ man/tidy.coxph.Rd | 5 +++++ man/tidy.crr.Rd | 4 ++++ man/tidy.cv.glmnet.Rd | 5 +++++ man/tidy.drc.Rd | 5 +++++ man/tidy.emmGrid.Rd | 5 +++++ man/tidy.epi.2by2.Rd | 4 ++++ man/tidy.ergm.Rd | 4 ++++ man/tidy.fitdistr.Rd | 5 +++++ man/tidy.fixest.Rd | 5 +++++ man/tidy.gam.Rd | 5 +++++ man/tidy.garch.Rd | 5 +++++ man/tidy.geeglm.Rd | 5 +++++ man/tidy.glht.Rd | 5 +++++ man/tidy.glmnet.Rd | 5 +++++ man/tidy.gmm.Rd | 5 +++++ man/tidy.ivreg.Rd | 5 +++++ man/tidy.kappa.Rd | 5 +++++ man/tidy.kde.Rd | 5 +++++ man/tidy.lavaan.Rd | 5 +++++ man/tidy.lm.beta.Rd | 5 +++++ man/tidy.lmodel2.Rd | 5 +++++ man/tidy.lsmobj.Rd | 5 +++++ man/tidy.map.Rd | 5 +++++ man/tidy.margins.Rd | 6 ++++++ man/tidy.mediate.Rd | 6 ++++++ man/tidy.mfx.Rd | 7 +++++++ man/tidy.mjoint.Rd | 4 ++++ man/tidy.mle2.Rd | 5 +++++ man/tidy.mlogit.Rd | 5 +++++ man/tidy.muhaz.Rd | 8 ++++++++ man/tidy.multinom.Rd | 5 +++++ man/tidy.negbin.Rd | 5 +++++ man/tidy.orcutt.Rd | 5 +++++ man/tidy.poLCA.Rd | 5 +++++ man/tidy.polr.Rd | 4 ++++ man/tidy.pyears.Rd | 5 +++++ man/tidy.rcorr.Rd | 5 +++++ man/tidy.ref.grid.Rd | 5 +++++ man/tidy.regsubsets.Rd | 5 +++++ man/tidy.ridgelm.Rd | 6 ++++++ man/tidy.roc.Rd | 5 +++++ man/tidy.sarlm.Rd | 5 +++++ man/tidy.speedglm.Rd | 5 +++++ man/tidy.speedlm.Rd | 5 +++++ man/tidy.summary.glht.Rd | 5 +++++ man/tidy.summary_emm.Rd | 5 +++++ man/tidy.survdiff.Rd | 5 +++++ man/tidy.survexp.Rd | 5 +++++ man/tidy.survfit.Rd | 5 +++++ man/tidy.survreg.Rd | 5 +++++ man/tidy.svyolr.Rd | 5 +++++ man/tidy.systemfit.Rd | 5 +++++ man/tidy.varest.Rd | 6 ++++++ man/tidy.zoo.Rd | 5 +++++ man/tidy_gam_hastie.Rd | 5 +++++ man/tidy_irlba.Rd | 5 +++++ man/tidy_svd.Rd | 5 +++++ 198 files changed, 1006 insertions(+), 2 deletions(-) diff --git a/R/aer-tidiers.R b/R/aer-tidiers.R index ba3e6616a..63314aba1 100644 --- a/R/aer-tidiers.R +++ b/R/aer-tidiers.R @@ -23,7 +23,9 @@ #' ) #' #' @examples -#' +#' +#' if (requireNamespace("AER", quietly = TRUE)) { +#' #' library(AER) #' #' data("CigarettesSW", package = "AER") @@ -45,6 +47,9 @@ #' augment(ivr, newdata = CigarettesSW) #' #' glance(ivr) +#' +#' } +#' #' @export #' @seealso [tidy()], [AER::ivreg()] #' @family ivreg tidiers diff --git a/R/auc-tidiers.R b/R/auc-tidiers.R index bac16411e..7680cd819 100644 --- a/R/auc-tidiers.R +++ b/R/auc-tidiers.R @@ -7,6 +7,8 @@ #' @evalRd return_tidy("cutoff", "tpr", "fpr") #' #' @examples +#' +#' if (requireNamespace("AUC", quietly = TRUE)) { #' #' library(AUC) #' data(churn) @@ -36,6 +38,9 @@ #' #' ggplot(rocs, aes(fpr, tpr, color = algorithm)) + #' geom_line() +#' +#' } +#' #' @export #' @aliases auc_tidiers roc_tidiers #' @seealso [tidy()], [AUC::roc()] diff --git a/R/bbmle-tidiers.R b/R/bbmle-tidiers.R index 82d583002..9c6ce246d 100644 --- a/R/bbmle-tidiers.R +++ b/R/bbmle-tidiers.R @@ -8,6 +8,8 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("bbmle", quietly = TRUE)) { #' #' library(bbmle) #' @@ -20,6 +22,9 @@ #' ) #' #' tidy(fit) +#' +#' } +#' #' @export #' @seealso [tidy()], [bbmle::mle2()], [tidy_optim()] #' @aliases mle2_tidiers bbmle_tidiers diff --git a/R/betareg-tidiers.R b/R/betareg-tidiers.R index 3c33e59ca..8e207c1e2 100644 --- a/R/betareg-tidiers.R +++ b/R/betareg-tidiers.R @@ -17,6 +17,8 @@ #' At least one term will have been used to model the precision `phi`. #' #' @examples +#' +#' if (requireNamespace("betareg", quietly = TRUE)) { #' #' library(betareg) #' data("GasolineYield", package = "betareg") @@ -31,6 +33,9 @@ #' augment(mod) #' #' glance(mod) +#' +#' } +#' #' @export #' @seealso [tidy()], [betareg::betareg()] #' @family betareg tidiers diff --git a/R/bingroup-tidiers.R b/R/bingroup-tidiers.R index 55f96df34..1f022a97d 100644 --- a/R/bingroup-tidiers.R +++ b/R/bingroup-tidiers.R @@ -9,6 +9,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("binGroup", quietly = TRUE)) { #' #' library(binGroup) #' library(dplyr) @@ -17,6 +19,9 @@ #' bw <- binWidth(100, .1) #' bw #' tidy(bw) +#' +#' } +#' #' @export #' @family bingroup tidiers #' @aliases binwidth_tidiers @@ -39,6 +44,8 @@ tidy.binWidth <- function(x, ...) { #' ) #' #' @examples +#' +#' if (requireNamespace("binGroup", quietly = TRUE)) { #' #' library(binGroup) #' des <- binDesign( @@ -53,6 +60,9 @@ tidy.binWidth <- function(x, ...) { #' library(ggplot2) #' ggplot(tidy(des), aes(n, power)) + #' geom_line() +#' +#' } +#' #' @export #' @family bingroup tidiers #' @aliases bindesign_tidiers @@ -77,7 +87,9 @@ tidy.binDesign <- function(x, ...) { #' ) #' #' @examples -#' +#' +#' if (requireNamespace("binGroup", quietly = TRUE)) { +#' #' library(binGroup) #' des <- binDesign( #' nmax = 300, delta = 0.06, @@ -90,6 +102,9 @@ tidy.binDesign <- function(x, ...) { #' library(ggplot2) #' ggplot(tidy(des), aes(n, power)) + #' geom_line() +#' +#' } +#' #' @export #' @family bingroup tidiers #' @seealso [glance()], [binGroup::binDesign()] diff --git a/R/boot-tidiers.R b/R/boot-tidiers.R index b41b98185..d452ec5b7 100644 --- a/R/boot-tidiers.R +++ b/R/boot-tidiers.R @@ -22,6 +22,8 @@ #' `std.error` columns shown. #' #' @examples +#' +#' if (requireNamespace("boot", quietly = TRUE)) { #' #' library(boot) #' @@ -40,6 +42,9 @@ #' bootres <- boot(clotting, bootfun, R = 999) #' tidy(g1, conf.int = TRUE) #' tidy(bootres, conf.int = TRUE) +#' +#' } +#' #' @export #' @aliases boot_tidiers #' @seealso [tidy()], [boot::boot()], [boot::tsboot()], [boot::boot.ci()], diff --git a/R/car-tidiers.R b/R/car-tidiers.R index e8fee5255..f40114102 100644 --- a/R/car-tidiers.R +++ b/R/car-tidiers.R @@ -11,10 +11,15 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("car", quietly = TRUE)) { #' #' dw <- car::durbinWatsonTest(lm(mpg ~ wt, data = mtcars)) #' tidy(dw) #' glance(dw) # same output for all durbinWatsonTests +#' +#' } +#' #' @name durbinWatsonTest_tidiers #' @family car tidiers #' @export diff --git a/R/caret-tidiers.R b/R/caret-tidiers.R index 5b062b0f8..26a429c10 100644 --- a/R/caret-tidiers.R +++ b/R/caret-tidiers.R @@ -18,6 +18,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("caret", quietly = TRUE)) { #' #' library(caret) #' @@ -46,6 +48,9 @@ #' #' tidy(six_class_cm) #' tidy(six_class_cm, by_class = FALSE) +#' +#' } +#' #' @aliases caret_tidiers confusionMatrix_tidiers #' @export #' @seealso [tidy()], [caret::confusionMatrix()] diff --git a/R/cmprsk-tidiers.R b/R/cmprsk-tidiers.R index 0fd96ce44..b31d72739 100644 --- a/R/cmprsk-tidiers.R +++ b/R/cmprsk-tidiers.R @@ -16,6 +16,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("cmprsk", quietly = TRUE)) { #' #' library(cmprsk) #' lrf_time <- rexp(100) #time to loco-regional failure (lrf) @@ -25,6 +27,8 @@ #' x <- crr(lrf_time, lrf_event, cbind(trt, strt)) #' tidy(x, conf.int = TRUE) #' glance(x) +#' +#' } #' #' @aliases cmprsk_tidiers #' @export diff --git a/R/drc-tidiers.R b/R/drc-tidiers.R index 3b87c7b6a..d19e34b7b 100644 --- a/R/drc-tidiers.R +++ b/R/drc-tidiers.R @@ -14,6 +14,8 @@ #' The `curveid` column indicates the curve. #' #' @examples +#' +#' if (requireNamespace("drc", quietly = TRUE)) { #' #' library(drc) #' @@ -27,6 +29,9 @@ #' glance(mod) #' #' augment(mod, selenium) +#' +#' } +#' #' @export #' @seealso [tidy()], [drc::drm()] #' @family drc tidiers diff --git a/R/emmeans-tidiers.R b/R/emmeans-tidiers.R index 7d2c5b652..abc6f3ea3 100644 --- a/R/emmeans-tidiers.R +++ b/R/emmeans-tidiers.R @@ -27,6 +27,8 @@ #' passed on to [emmeans::summary.emmGrid()] or [lsmeans::summary.ref.grid()]. #' #' @examples +#' +#' if (requireNamespace("emmeans", quietly = TRUE)) { #' #' library(emmeans) #' # linear model for sales of oranges per day @@ -68,6 +70,9 @@ #' #' # joint_tests #' tidy(joint_tests(oranges_lm1)) +#' +#' } +#' #' @aliases emmeans_tidiers #' @export #' @family emmeans tidiers diff --git a/R/epiR-tidiers.R b/R/epiR-tidiers.R index d52343ecc..e4d877231 100644 --- a/R/epiR-tidiers.R +++ b/R/epiR-tidiers.R @@ -21,6 +21,8 @@ #' #' @examples #' +#' if (requireNamespace("epiR", quietly = TRUE)) { +#' #' library(epiR) #' #' dat <- matrix(c(13, 2163, 5, 3349), nrow = 2, byrow = TRUE) @@ -36,6 +38,8 @@ #' tidy(fit, parameters = "moa") #' tidy(fit, parameters = "stat") #' +#' } +#' #' @export #' @seealso [tidy()], [epiR::epi.2by2()] #' @family epiR tidiers diff --git a/R/ergm-tidiers.R b/R/ergm-tidiers.R index 2c09dc451..9ba4c7135 100644 --- a/R/ergm-tidiers.R +++ b/R/ergm-tidiers.R @@ -21,6 +21,8 @@ #' \item{p.value}{The two-sided p-value} #' #' @examples +#' +#' if (requireNamespace("ergm", quietly = TRUE)) { #' #' library(ergm) #' # Using the same example as the ergm package @@ -43,6 +45,8 @@ #' glance(gest, deviance = TRUE) #' glance(gest, mcmc = TRUE) #' +#' } +#' #' @references Hunter DR, Handcock MS, Butts CT, Goodreau SM, Morris M (2008b). #' \pkg{ergm}: A Package to Fit, Simulate and Diagnose Exponential-Family #' Models for Networks. *Journal of Statistical Software*, 24(3). diff --git a/R/fixest-tidiers.R b/R/fixest-tidiers.R index 4d22023a5..0d12b0e82 100644 --- a/R/fixest-tidiers.R +++ b/R/fixest-tidiers.R @@ -26,6 +26,9 @@ #' \url{https://github.com/sgaure/lfe/issues/1#issuecomment-530646990}) #' #' @examples +#' +#' if (requireNamespace("fixest", quietly = TRUE)) { +#' #' \donttest{ #' library(fixest) #' @@ -50,6 +53,8 @@ #' # Approach (1) is preferred. #' #' } +#' +#' } #' #' @export #' @family fixest tidiers diff --git a/R/gam-tidiers.R b/R/gam-tidiers.R index 5087a5f2e..1602a4338 100644 --- a/R/gam-tidiers.R +++ b/R/gam-tidiers.R @@ -17,12 +17,17 @@ #' [tidy.gam()]. #' #' @examples +#' +#' if (requireNamespace("gam", quietly = TRUE)) { #' #' library(gam) #' g <- gam(mpg ~ s(hp, 4) + am + qsec, data = mtcars) #' #' tidy(g) #' glance(g) +#' +#' } +#' #' @export #' @family gam tidiers #' @aliases Gam_tidiers diff --git a/R/geepack-tidiers.R b/R/geepack-tidiers.R index dcf0ba2b9..533c1e8d6 100644 --- a/R/geepack-tidiers.R +++ b/R/geepack-tidiers.R @@ -14,6 +14,8 @@ #' missingness in the data beforehand. #' #' @examples +#' +#' if (requireNamespace("geepack", quietly = TRUE)) { #' #' library(geepack) #' data(state) @@ -28,6 +30,9 @@ #' #' tidy(geefit) #' tidy(geefit, conf.int = TRUE) +#' +#' } +#' #' @evalRd return_tidy(regression = TRUE) #' #' @export diff --git a/R/glmnet-cv-glmnet-tidiers.R b/R/glmnet-cv-glmnet-tidiers.R index dbda0d417..c63c2e0b9 100644 --- a/R/glmnet-cv-glmnet-tidiers.R +++ b/R/glmnet-cv-glmnet-tidiers.R @@ -17,6 +17,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("glmnet", quietly = TRUE)) { #' #' library(glmnet) #' set.seed(27) @@ -68,6 +70,9 @@ #' geom_line() + #' geom_vline(xintercept = glance_cv$lambda.min) + #' geom_vline(xintercept = glance_cv$lambda.1se, lty = 2) +#' +#' } +#' #' @export #' @family glmnet tidiers #' @seealso [tidy()], [glmnet::cv.glmnet()] diff --git a/R/glmnet-glmnet-tidiers.R b/R/glmnet-glmnet-tidiers.R index e80e7c838..11828d2d6 100644 --- a/R/glmnet-glmnet-tidiers.R +++ b/R/glmnet-glmnet-tidiers.R @@ -25,6 +25,8 @@ #' choice of lambda. #' #' @examples +#' +#' if (requireNamespace("glmnet", quietly = TRUE)) { #' #' library(glmnet) #' @@ -54,6 +56,9 @@ #' g2 <- sample(1:2, 100, replace = TRUE) #' fit2 <- glmnet(x, g2, family = "binomial") #' tidy(fit2) +#' +#' } +#' #' @export #' @aliases glmnet_tidiers #' @family glmnet tidiers diff --git a/R/gmm-tidiers.R b/R/gmm-tidiers.R index 4d465061d..fe4773803 100644 --- a/R/gmm-tidiers.R +++ b/R/gmm-tidiers.R @@ -9,6 +9,8 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("gmm", quietly = TRUE)) { #' #' library(gmm) #' @@ -72,6 +74,9 @@ #' geom_point() + #' geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + #' geom_vline(xintercept = 0, color = "red", lty = 2) +#' +#' } +#' #' @export #' @aliases gmm_tidiers #' @family gmm tidiers diff --git a/R/hmisc-tidiers.R b/R/hmisc-tidiers.R index 112c03a6a..6348d7771 100644 --- a/R/hmisc-tidiers.R +++ b/R/hmisc-tidiers.R @@ -22,6 +22,8 @@ #' output. #' #' @examples +#' +#' if (requireNamespace("Hmisc", quietly = TRUE)) { #' #' library(Hmisc) #' @@ -43,6 +45,9 @@ #' ggplot(td, aes(estimate, p.value)) + #' geom_point() + #' scale_y_log10() +#' +#' } +#' #' @export #' @aliases rcorr_tidiers Hmisc_tidiers #' @seealso [tidy()], [Hmisc::rcorr()] diff --git a/R/joinerml-tidiers.R b/R/joinerml-tidiers.R index d73a821b9..4bac37364 100644 --- a/R/joinerml-tidiers.R +++ b/R/joinerml-tidiers.R @@ -15,6 +15,9 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("joineRML", quietly = TRUE)) { +#' #' \dontrun{ #' # Fit a joint model with bivariate longitudinal outcomes #' library(joineRML) @@ -57,6 +60,7 @@ #' # Extract model statistics #' glance(fit) #' } +#' } #' #' @export #' @aliases mjoint_tidiers joinerml_tidiers diff --git a/R/kendall-tidiers.R b/R/kendall-tidiers.R index 9dac6acf5..b7c2bc2b1 100644 --- a/R/kendall-tidiers.R +++ b/R/kendall-tidiers.R @@ -14,6 +14,9 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("Kendall", quietly = TRUE)) { +#' #' library(Kendall) #' #' A <- c(2.5, 2.5, 2.5, 2.5, 5, 6.5, 6.5, 10, 10, 10, 10, 10, 14, 14, 14, 16, 17) @@ -27,6 +30,9 @@ #' #' t_res <- SeasonalMannKendall(ts(A)) #' tidy(t_res) +#' +#' } +#' #' @export #' @seealso [tidy()], [Kendall::Kendall()], [Kendall::MannKendall()], #' [Kendall::SeasonalMannKendall()] diff --git a/R/ks-tidiers.R b/R/ks-tidiers.R index 92a88edca..c9835df9e 100644 --- a/R/ks-tidiers.R +++ b/R/ks-tidiers.R @@ -11,6 +11,8 @@ #' on the output to return to a wide format. #' #' @examples +#' +#' if (requireNamespace("ks", quietly = TRUE)) { #' #' library(ks) #' @@ -39,6 +41,9 @@ #' #' td3 <- tidy(k3) #' td3 +#' +#' } +#' #' @export #' @aliases kde_tidiers ks_tidiers #' @seealso [tidy()], [ks::kde()] diff --git a/R/lavaan-tidiers.R b/R/lavaan-tidiers.R index a4980c139..5b488d728 100644 --- a/R/lavaan-tidiers.R +++ b/R/lavaan-tidiers.R @@ -31,6 +31,9 @@ #' variances of exogenous covariates.} #' #' @examples +#' +#' if (requireNamespace("lavaan", quietly = TRUE)) { +#' #' \dontrun{ #' library(lavaan) #' @@ -41,6 +44,8 @@ #' tidy(cfa.fit) #' } #' +#' } +#' #' @export #' @aliases lavaan_tidiers sem_tidiers cfa_tidiers #' @family lavaan tidiers diff --git a/R/leaps.R b/R/leaps.R index 855beaa8a..6b0c6eac2 100644 --- a/R/leaps.R +++ b/R/leaps.R @@ -14,9 +14,14 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("leaps", quietly = TRUE)) { #' #' all_fits <- leaps::regsubsets(hp ~ ., mtcars) #' tidy(all_fits) +#' +#' } +#' #' @aliases leaps_tidiers #' @export #' @seealso [tidy()], [leaps::regsubsets()] diff --git a/R/list-svd-tidiers.R b/R/list-svd-tidiers.R index f23945daf..adb603370 100644 --- a/R/list-svd-tidiers.R +++ b/R/list-svd-tidiers.R @@ -5,6 +5,8 @@ #' @param x A list with components `u`, `d`, `v` returned by [base::svd()]. #' #' @examples +#' +#' if (requireNamespace("modeldata", quietly = TRUE)) { #' #' library(modeldata) #' data(hpc_data) @@ -33,6 +35,9 @@ #' ggplot(aes(class, value)) + #' geom_boxplot() + #' facet_wrap(~PC, scale = "free_y") +#' +#' } +#' #' @seealso [base::svd()] #' @aliases svd_tidiers #' @family svd tidiers diff --git a/R/lm-beta-tidiers.R b/R/lm-beta-tidiers.R index 12d032442..85566a7c0 100644 --- a/R/lm-beta-tidiers.R +++ b/R/lm-beta-tidiers.R @@ -14,6 +14,8 @@ #' the model with `na.action = na.exclude`. #' #' @examples +#' +#' if (requireNamespace("lm.beta", quietly = TRUE)) { #' #' library(lm.beta) #' @@ -30,6 +32,9 @@ #' #' std2 <- lm.beta(mod2) #' tidy(std2, conf.int = TRUE) +#' +#' } +#' #' @export #' @family lm tidiers tidy.lm.beta <- function(x, conf.int = FALSE, conf.level = 0.95, ...) { diff --git a/R/lmodel2-tidiers.R b/R/lmodel2-tidiers.R index e222c7dae..f338b22fd 100644 --- a/R/lmodel2-tidiers.R +++ b/R/lmodel2-tidiers.R @@ -24,6 +24,8 @@ #' `vignette("mod2user", package = "lmodel2")`. #' #' @examples +#' +#' if (requireNamespace("lmodel2", quietly = TRUE)) { #' #' library(lmodel2) #' @@ -40,6 +42,9 @@ #' geom_point() + #' geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + #' geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) +#' +#' } +#' #' @export #' @seealso [tidy()], [lmodel2::lmodel2()] #' @aliases lmodel2_tidiers diff --git a/R/lmtest-tidiers.R b/R/lmtest-tidiers.R index ff5c8c3c0..c364046a8 100644 --- a/R/lmtest-tidiers.R +++ b/R/lmtest-tidiers.R @@ -8,6 +8,8 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("lmtest", quietly = TRUE)) { #' #' library(lmtest) #' @@ -31,6 +33,9 @@ #' # Users can control this with the "save = TRUE" argument of coeftest(). #' glance(coeftest(m)) #' glance(coeftest(m, save = TRUE)) # More columns +#' +#' } +#' #' @export #' @seealso [tidy()], [lmtest::coeftest()] #' @aliases lmtest_tidiers coeftest_tidiers diff --git a/R/maps-tidiers.R b/R/maps-tidiers.R index 1bbc24fcd..5b04022b8 100644 --- a/R/maps-tidiers.R +++ b/R/maps-tidiers.R @@ -13,6 +13,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("maps", quietly = TRUE)) { #' #' library(maps) #' library(ggplot2) @@ -28,6 +30,9 @@ #' data = tx, geom = "polygon", group = group, #' colour = I("white") #' ) +#' +#' } +#' #' @export #' @seealso [tidy()], [maps::map()] #' @aliases maps_tidiers diff --git a/R/margins-tidiers.R b/R/margins-tidiers.R index 451a1b1b0..7afcdf321 100644 --- a/R/margins-tidiers.R +++ b/R/margins-tidiers.R @@ -15,6 +15,9 @@ #' users can simply run the underlying model to obtain the same information. #' #' @examples +#' +#' if (requireNamespace("margins", quietly = TRUE)) { +#' #' library(margins) #' #' ## Example 1: Logit model ## @@ -58,6 +61,9 @@ #' variables = "wt", ## Main var #' at = list(cyl = c(4,6,8), drat = c(3, 3.5, 4))) ## Modulating vars #' tidy(marg_ie2) +#' +#' } +#' #' @export #' @aliases margins_tidiers #' @family margins tidiers diff --git a/R/mass-fitdistr-tidiers.R b/R/mass-fitdistr-tidiers.R index dfcb2e75b..f63eef3e3 100644 --- a/R/mass-fitdistr-tidiers.R +++ b/R/mass-fitdistr-tidiers.R @@ -7,6 +7,8 @@ #' @evalRd return_tidy("term", "estimate", "std.error") #' #' @examples +#' +#' if (requireNamespace("MASS", quietly = TRUE)) { #' #' set.seed(2015) #' x <- rnorm(100, 5, 2) @@ -16,6 +18,9 @@ #' #' tidy(fit) #' glance(fit) +#' +#' } +#' #' @export #' @family fitdistr tidiers #' @aliases fitdistr_tidiers diff --git a/R/mass-negbin-tidiers.R b/R/mass-negbin-tidiers.R index a6801add6..87d20db1b 100644 --- a/R/mass-negbin-tidiers.R +++ b/R/mass-negbin-tidiers.R @@ -16,6 +16,9 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("MASS", quietly = TRUE)) { +#' #' library(MASS) #' #' r <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine) @@ -23,6 +26,8 @@ #' tidy(r) #' glance(r) #' +#' } +#' #' @aliases glm.nb_tidiers #' @family glm.nb tidiers #' @seealso [glance()], [MASS::glm.nb()] diff --git a/R/mass-polr-tidiers.R b/R/mass-polr-tidiers.R index 2b62786f2..f1e99dad9 100644 --- a/R/mass-polr-tidiers.R +++ b/R/mass-polr-tidiers.R @@ -9,6 +9,8 @@ #' @template param_unused_dots #' #' @examples +#' +#' if (requireNamespace("MASS", quietly = TRUE)) { #' #' library(MASS) #' @@ -22,6 +24,8 @@ #' fit2 <- polr(factor(gear) ~ am + mpg + qsec, data = mtcars) #' tidy(fit, p.values = TRUE) #' +#' } +#' #' @evalRd return_tidy(regression = TRUE) #' #' @details In `broom 0.7.0` the `coefficient_type` column was renamed to diff --git a/R/mass-ridgelm-tidiers.R b/R/mass-ridgelm-tidiers.R index f638bb862..aa44fed68 100644 --- a/R/mass-ridgelm-tidiers.R +++ b/R/mass-ridgelm-tidiers.R @@ -10,6 +10,9 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("MASS", quietly = TRUE)) { +#' #' #' names(longley)[1] <- "y" #' fit1 <- MASS::lm.ridge(y ~ ., longley) @@ -32,6 +35,9 @@ #' ggplot(td2, aes(lambda, GCV)) + #' geom_line() + #' geom_vline(xintercept = g2$lambdaGCV, col = "red", lty = 2) +#' +#' } +#' #' @export #' @aliases ridgelm_tidiers #' @family ridgelm tidiers diff --git a/R/mass-rlm-tidiers.R b/R/mass-rlm-tidiers.R index cd92d4ed1..b57f6eb21 100644 --- a/R/mass-rlm-tidiers.R +++ b/R/mass-rlm-tidiers.R @@ -15,6 +15,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("MASS", quietly = TRUE)) { #' #' library(MASS) #' @@ -23,6 +25,8 @@ #' tidy(r) #' augment(r) #' glance(r) +#' +#' } #' @export #' @aliases rlm_tidiers #' @family rlm tidiers diff --git a/R/mclust-tidiers.R b/R/mclust-tidiers.R index f3c7d6d3c..1a609fb05 100644 --- a/R/mclust-tidiers.R +++ b/R/mclust-tidiers.R @@ -19,6 +19,7 @@ #' @examples #' #' if (requireNamespace("mclust", quietly = TRUE)) { +#' #' library(dplyr) #' library(mclust) #' set.seed(27) @@ -43,7 +44,9 @@ #' tidy(m) #' augment(m, points) #' glance(m) +#' #' } +#' #' @export #' @aliases mclust_tidiers #' @seealso [tidy()], [mclust::Mclust()] diff --git a/R/mediate-tidiers.R b/R/mediate-tidiers.R index 04e0df679..c4582468c 100644 --- a/R/mediate-tidiers.R +++ b/R/mediate-tidiers.R @@ -11,6 +11,9 @@ #' effect in the control and treatment groups, respectively. And the last #' two the direct effect in each group. #' @examples +#' +#' if (requireNamespace("mediation", quietly = TRUE)) { +#' #' library(mediation) #' data(jobs) #' @@ -21,6 +24,9 @@ #' tidy(mod) #' tidy(mod, conf.int = TRUE) #' tidy(mod, conf.int = TRUE, conf.level = .99) +#' +#' } +#' #' @export #' @seealso [tidy()], [mediation::mediate()] #' @family mediate tidiers diff --git a/R/mfx-tidiers.R b/R/mfx-tidiers.R index c896ca123..a7349f120 100644 --- a/R/mfx-tidiers.R +++ b/R/mfx-tidiers.R @@ -33,6 +33,10 @@ #' in the data, or ii) the average of the sample marginal effects. See #' `vignette("mfxarticle")` from the `mfx` package for more details. #' @examples +#' +#' +#' if (requireNamespace("mfx", quietly = TRUE)) { +#' #' \dontrun{ #' library(mfx) #' @@ -52,6 +56,9 @@ #' augment(mod_probmfx) #' glance(mod_probmfx) #' } +#' +#' } +#' #' @family mfx tidiers #' @seealso [tidy()], [mfx::logitmfx()], [mfx::negbinmfx()], [mfx::poissonmfx()], [mfx::probitmfx()] #' @export diff --git a/R/mgcv-tidiers.R b/R/mgcv-tidiers.R index 0524bf668..d05faf68d 100644 --- a/R/mgcv-tidiers.R +++ b/R/mgcv-tidiers.R @@ -26,6 +26,8 @@ #' #' #' @examples +#' +#' if (requireNamespace("mgcv", quietly = TRUE)) { #' #' g <- mgcv::gam(mpg ~ s(hp) + am + qsec, data = mtcars) #' @@ -33,6 +35,9 @@ #' tidy(g, parametric = TRUE) #' glance(g) #' augment(g) +#' +#' } +#' #' @export #' @aliases mgcv_tidiers gam_tidiers tidy.gam #' @family mgcv tidiers diff --git a/R/mlogit-tidiers.R b/R/mlogit-tidiers.R index 3d0f0fcef..1901596a6 100644 --- a/R/mlogit-tidiers.R +++ b/R/mlogit-tidiers.R @@ -10,6 +10,9 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("mlogit", quietly = TRUE)) { +#' #' \dontrun{ #' library(mlogit) #' data("Fishing", package = "mlogit") @@ -21,6 +24,8 @@ #' glance(m) #' } #' +#' } +#' #' @aliases mlogit_tidiers #' @export #' @family mlogit tidiers diff --git a/R/muhaz-tidiers.R b/R/muhaz-tidiers.R index 2cf92fbdd..b087ea966 100644 --- a/R/muhaz-tidiers.R +++ b/R/muhaz-tidiers.R @@ -10,12 +10,20 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("muhaz", quietly = TRUE)) { +#' if (requireNamespace("survival", quietly = TRUE)) { +#' #' library(muhaz) #' library(survival) #' #' x <- muhaz(ovarian$futime, ovarian$fustat) #' tidy(x) #' glance(x) +#' +#' } +#' } +#' #' @aliases muhaz_tidiers #' @export #' @seealso [tidy()], [muhaz::muhaz()] diff --git a/R/multcomp-tidiers.R b/R/multcomp-tidiers.R index 272e08c43..b8bb32cc6 100644 --- a/R/multcomp-tidiers.R +++ b/R/multcomp-tidiers.R @@ -8,6 +8,8 @@ #' @evalRd return_tidy("contrast", "null.value", "estimate") #' #' @examples +#' +#' if (requireNamespace("multcomp", quietly = TRUE)) { #' #' library(multcomp) #' library(ggplot2) @@ -32,6 +34,9 @@ #' #' cld <- cld(wht) #' tidy(cld) +#' +#' } +#' #' @aliases multcomp_tidiers #' @export #' @family multcomp tidiers diff --git a/R/nnet-tidiers.R b/R/nnet-tidiers.R index cdee1b793..26743766e 100644 --- a/R/nnet-tidiers.R +++ b/R/nnet-tidiers.R @@ -11,6 +11,8 @@ #' @evalRd return_tidy("y.value", regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("nnet", quietly = TRUE)) { #' #' library(nnet) #' library(MASS) @@ -27,6 +29,9 @@ #' fit.gear <- multinom(gear ~ mpg + factor(am), data = mtcars) #' tidy(fit.gear) #' glance(fit.gear) +#' +#' } +#' #' @aliases multinom_tidiers nnet_tidiers #' @export #' @family multinom tidiers diff --git a/R/orcutt-tidiers.R b/R/orcutt-tidiers.R index 866d95c6f..afc43eeda 100644 --- a/R/orcutt-tidiers.R +++ b/R/orcutt-tidiers.R @@ -13,6 +13,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("orcutt", quietly = TRUE)) { #' #' library(orcutt) #' @@ -24,6 +26,9 @@ #' #' tidy(co) #' glance(co) +#' +#' } +#' #' @aliases orcutt_tidiers #' @export #' @family orcutt tidiers diff --git a/R/ordinal-clm-tidiers.R b/R/ordinal-clm-tidiers.R index 5dbc7f700..8294a9cff 100644 --- a/R/ordinal-clm-tidiers.R +++ b/R/ordinal-clm-tidiers.R @@ -10,6 +10,8 @@ #' @template param_unused_dots #' #' @examples +#' +#' if (requireNamespace("ordinal", quietly = TRUE)) { #' #' library(ordinal) #' @@ -26,6 +28,9 @@ #' fit2 <- clm(rating ~ temp, nominal = ~contact, data = wine) #' tidy(fit2) #' glance(fit2) +#' +#' } +#' #' @evalRd return_tidy(regression = TRUE) #' #' @details In `broom 0.7.0` the `coefficient_type` column was renamed to diff --git a/R/ordinal-clmm-tidiers.R b/R/ordinal-clmm-tidiers.R index ea38c8496..74494047b 100644 --- a/R/ordinal-clmm-tidiers.R +++ b/R/ordinal-clmm-tidiers.R @@ -7,6 +7,8 @@ #' @template param_unused_dots #' #' @examples +#' +#' if (requireNamespace("ordinal", quietly = TRUE)) { #' #' library(ordinal) #' @@ -21,6 +23,9 @@ #' fit2 <- clmm(rating ~ temp + (1 | judge), nominal = ~contact, data = wine) #' tidy(fit2) #' glance(fit2) +#' +#' } +#' #' @evalRd return_tidy(regression = TRUE) #' #' @note In `broom 0.7.0` the `coefficient_type` column was renamed to diff --git a/R/polca-tidiers.R b/R/polca-tidiers.R index a90e19d0a..1f2bd96b8 100644 --- a/R/polca-tidiers.R +++ b/R/polca-tidiers.R @@ -13,6 +13,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("poLCA", quietly = TRUE)) { #' #' library(poLCA) #' library(dplyr) @@ -59,6 +61,9 @@ #' au2 <- augment(nes2a, data = election) #' au2 #' dim(au2) +#' +#' } +#' #' @aliases poLCA_tidiers #' @export #' @seealso [tidy()], [poLCA::poLCA()] diff --git a/R/psych-tidiers.R b/R/psych-tidiers.R index ba4c89672..2aa01fd05 100644 --- a/R/psych-tidiers.R +++ b/R/psych-tidiers.R @@ -16,6 +16,8 @@ #' to [psych::cohen.kappa()] when creating the `kappa` object. #' #' @examples +#' +#' if (requireNamespace("psych", quietly = TRUE)) { #' #' library(psych) #' @@ -30,6 +32,9 @@ #' ggplot(tidy(ck), aes(estimate, type)) + #' geom_point() + #' geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) +#' +#' } +#' #' @aliases kappa_tidiers psych_tidiers #' @export #' @seealso [tidy()], [psych::cohen.kappa()] diff --git a/R/rma-tidiers.R b/R/rma-tidiers.R index 5a3f8e67e..7ab14a01e 100644 --- a/R/rma-tidiers.R +++ b/R/rma-tidiers.R @@ -24,6 +24,8 @@ #' @export #' #' @examples +#' +#' if (requireNamespace("metafor", quietly = TRUE)) { #' #' library(metafor) #' @@ -40,6 +42,9 @@ #' meta_analysis <- rma(yi, vi, data = df, method = "EB") #' #' tidy(meta_analysis) +#' +#' } +#' #' @rdname metafor_tidiers #' tidy.rma <- function(x, conf.int = FALSE, conf.level = 0.95, diff --git a/R/spdep-tidiers.R b/R/spdep-tidiers.R index e7a30fd54..919812ab7 100644 --- a/R/spdep-tidiers.R +++ b/R/spdep-tidiers.R @@ -11,6 +11,9 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("spatialreg", quietly = TRUE)) { +#' #' \dontrun{ #' library(spatialreg) #' data(oldcol, package = "spdep") @@ -42,6 +45,8 @@ #' augment(crime_sac) #' } #' +#' } +#' #' @aliases spatialreg_tidiers #' @export #' @family spatialreg tidiers diff --git a/R/speedglm-speedglm-tidiers.R b/R/speedglm-speedglm-tidiers.R index e8578746e..bcd4d9e6a 100644 --- a/R/speedglm-speedglm-tidiers.R +++ b/R/speedglm-speedglm-tidiers.R @@ -9,6 +9,8 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("speedglm", quietly = TRUE)) { #' #' library(speedglm) #' @@ -21,6 +23,9 @@ #' #' tidy(fit) #' glance(fit) +#' +#' } +#' #' @aliases speedglm_tidiers #' @export #' @family speedlm tidiers diff --git a/R/speedglm-speedlm-tidiers.R b/R/speedglm-speedlm-tidiers.R index 7dae217a3..fce4630f2 100644 --- a/R/speedglm-speedlm-tidiers.R +++ b/R/speedglm-speedlm-tidiers.R @@ -8,12 +8,17 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("speedglm", quietly = TRUE)) { #' #' mod <- speedglm::speedlm(mpg ~ wt + qsec, data = mtcars, fitted = TRUE) #' #' tidy(mod) #' glance(mod) #' augment(mod) +#' +#' } +#' #' @aliases speedlm_tidiers #' @export #' @family speedlm tidiers diff --git a/R/survey-tidiers.R b/R/survey-tidiers.R index 9a80e1f9c..43ee80573 100644 --- a/R/survey-tidiers.R +++ b/R/survey-tidiers.R @@ -7,6 +7,8 @@ #' @export #' #' @examples +#' +#' if (requireNamespace("MASS", quietly = TRUE)) { #' #' library(MASS) #' @@ -14,6 +16,9 @@ #' #' tidy(fit, exponentiate = TRUE, conf.int = TRUE) #' glance(fit) +#' +#' } +#' #' @evalRd return_tidy(regression = TRUE) #' #' @aliases svyolr_tidiers diff --git a/R/survival-aareg-tidiers.R b/R/survival-aareg-tidiers.R index 2920f3b8e..19c656675 100644 --- a/R/survival-aareg-tidiers.R +++ b/R/survival-aareg-tidiers.R @@ -18,6 +18,8 @@ #' `dfbeta = TRUE`. #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' @@ -28,6 +30,9 @@ #' ) #' #' tidy(afit) +#' +#' } +#' #' @aliases aareg_tidiers #' @export #' @seealso [tidy()], [survival::aareg()] diff --git a/R/survival-cch-tidiers.R b/R/survival-cch-tidiers.R index 3456e3422..f009d0da2 100644 --- a/R/survival-cch-tidiers.R +++ b/R/survival-cch-tidiers.R @@ -8,6 +8,8 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' @@ -35,6 +37,9 @@ #' geom_point() + #' geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) + #' geom_vline(xintercept = 0) +#' +#' } +#' #' @aliases cch_tidiers #' @export #' @seealso [tidy()], [survival::cch()] diff --git a/R/survival-coxph-tidiers.R b/R/survival-coxph-tidiers.R index e0fd2a4a2..4982ec76b 100644 --- a/R/survival-coxph-tidiers.R +++ b/R/survival-coxph-tidiers.R @@ -14,6 +14,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' @@ -54,6 +56,9 @@ #' #' ggplot(expected, aes(time, .fitted, color = sex)) + #' geom_point() +#' +#' } +#' #' @aliases coxph_tidiers #' @export #' @seealso [tidy()], [survival::coxph()] diff --git a/R/survival-pyears-tidiers.R b/R/survival-pyears-tidiers.R index ae9a40062..892ae177e 100644 --- a/R/survival-pyears-tidiers.R +++ b/R/survival-pyears-tidiers.R @@ -18,6 +18,8 @@ #' this is simply the contents of `x$data`. #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' @@ -36,6 +38,9 @@ #' pfit2 <- pyears(Surv(ptime / 365.25, pstat) ~ temp.yr + temp.age + sex, mgus) #' tidy(pfit2) #' glance(pfit2) +#' +#' } +#' #' @aliases pyears_tidiers #' @export #' @seealso [tidy()], [survival::pyears()] diff --git a/R/survival-survdiff-tidiers.R b/R/survival-survdiff-tidiers.R index f8c7aa7c5..6e98715b5 100644 --- a/R/survival-survdiff-tidiers.R +++ b/R/survival-survdiff-tidiers.R @@ -7,6 +7,8 @@ #' @evalRd return_tidy("obs", "exp", "N") #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' @@ -17,6 +19,9 @@ #' #' tidy(s) #' glance(s) +#' +#' } +#' #' @aliases survdiff_tidiers #' @export #' @seealso [tidy()], [survival::survdiff()] diff --git a/R/survival-survexp-tidiers.R b/R/survival-survexp-tidiers.R index ae4459b4e..c41982ff1 100644 --- a/R/survival-survexp-tidiers.R +++ b/R/survival-survexp-tidiers.R @@ -9,6 +9,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' sexpfit <- survexp( @@ -24,6 +26,9 @@ #' #' tidy(sexpfit) #' glance(sexpfit) +#' +#' } +#' #' @aliases sexpfit_tidiers survexp_tidiers #' @export #' @seealso [tidy()], [survival::survexp()] diff --git a/R/survival-survfit-tidiers.R b/R/survival-survfit-tidiers.R index ed88d083b..a3f6f7caa 100644 --- a/R/survival-survfit-tidiers.R +++ b/R/survival-survfit-tidiers.R @@ -19,6 +19,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' cfit <- coxph(Surv(time, status) ~ age + sex, lung) @@ -42,6 +44,9 @@ #' ggplot(td_multi, aes(time, estimate, group = state)) + #' geom_line(aes(color = state)) + #' geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25) +#' +#' } +#' #' @aliases survfit_tidiers #' @export #' @seealso [tidy()], [survival::survfit()] diff --git a/R/survival-survreg-tidiers.R b/R/survival-survreg-tidiers.R index 9a0604f2d..a5e5cefb0 100644 --- a/R/survival-survreg-tidiers.R +++ b/R/survival-survreg-tidiers.R @@ -8,6 +8,8 @@ #' @evalRd return_tidy(regression = TRUE) #' #' @examples +#' +#' if (requireNamespace("survival", quietly = TRUE)) { #' #' library(survival) #' @@ -28,6 +30,9 @@ #' geom_point() + #' geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) + #' geom_vline(xintercept = 0) +#' +#' } +#' #' @aliases survreg_tidiers #' @export #' @seealso [tidy()], [survival::survreg()] diff --git a/R/systemfit-tidiers.R b/R/systemfit-tidiers.R index 7cfe24b22..3e461d81d 100644 --- a/R/systemfit-tidiers.R +++ b/R/systemfit-tidiers.R @@ -18,6 +18,8 @@ #' Default returns a tibble of six columns. #' #' @examples +#' +#' if (requireNamespace("systemfit", quietly = TRUE)) { #' #' set.seed(27) #' @@ -34,6 +36,9 @@ #' tidy(fit) #' #' tidy(fit, conf.int = TRUE) +#' +#' } +#' #' @export #' @seealso [tidy()], [systemfit::systemfit()] #' diff --git a/R/tseries-tidiers.R b/R/tseries-tidiers.R index 454a117a4..93cb6196d 100644 --- a/R/tseries-tidiers.R +++ b/R/tseries-tidiers.R @@ -16,6 +16,8 @@ #' ) #' #' @examples +#' +#' if (requireNamespace("tseries", quietly = TRUE)) { #' #' library(tseries) #' @@ -26,6 +28,9 @@ #' #' tidy(dax.garch) #' glance(dax.garch) +#' +#' } +#' #' @aliases garch_tidiers #' @export #' @family garch tidiers diff --git a/R/vars-tidiers.R b/R/vars-tidiers.R index 75fe7b14e..9f4d5fdd9 100644 --- a/R/vars-tidiers.R +++ b/R/vars-tidiers.R @@ -21,6 +21,9 @@ #' `conf.int = TRUE` will return a warning. #' #' @examples +#' +#' if (requireNamespace("vars", quietly = TRUE)) { +#' #' library(vars) #' data("Canada", package = "vars") #' @@ -28,6 +31,9 @@ #' #' tidy(mod) #' glance(mod) +#' +#' } +#' #' @export #' @seealso [tidy()], [vars::VAR()] #' @family vars tidiers diff --git a/R/zoo-tidiers.R b/R/zoo-tidiers.R index f66eec047..873f57b5e 100644 --- a/R/zoo-tidiers.R +++ b/R/zoo-tidiers.R @@ -7,6 +7,8 @@ #' @evalRd return_tidy("index", "series", "value") #' #' @examples +#' +#' if (requireNamespace("zoo", quietly = TRUE)) { #' #' library(zoo) #' library(ggplot2) @@ -31,6 +33,9 @@ #' Zrolled <- rollmean(Z, 5) #' ggplot(tidy(Zrolled), aes(index, value, color = series)) + #' geom_line() +#' +#' } +#' #' @aliases zoo_tidiers #' @export #' @seealso [tidy()], [zoo::zoo()] diff --git a/man/augment.Mclust.Rd b/man/augment.Mclust.Rd index 382e33e07..735855f36 100644 --- a/man/augment.Mclust.Rd +++ b/man/augment.Mclust.Rd @@ -71,6 +71,7 @@ missing at this time. \examples{ if (requireNamespace("mclust", quietly = TRUE)) { + library(dplyr) library(mclust) set.seed(27) @@ -95,7 +96,9 @@ m <- mclust::Mclust(points) tidy(m) augment(m, points) glance(m) + } + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[mclust:Mclust]{mclust::Mclust()}} diff --git a/man/augment.betareg.Rd b/man/augment.betareg.Rd index 114c28147..ae189155e 100644 --- a/man/augment.betareg.Rd +++ b/man/augment.betareg.Rd @@ -96,6 +96,8 @@ For additional details on Cook's distance, see } \examples{ +if (requireNamespace("betareg", quietly = TRUE)) { + library(betareg) data("GasolineYield", package = "betareg") @@ -109,6 +111,9 @@ tidy(mod, conf.int = TRUE, conf.level = .99) augment(mod) glance(mod) + +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[betareg:betareg]{betareg::betareg()}} diff --git a/man/augment.clm.Rd b/man/augment.clm.Rd index cf7e2b25a..e38aeb714 100644 --- a/man/augment.clm.Rd +++ b/man/augment.clm.Rd @@ -84,6 +84,8 @@ missing at this time. } \examples{ +if (requireNamespace("ordinal", quietly = TRUE)) { + library(ordinal) fit <- clm(rating ~ temp * contact, data = wine) @@ -99,6 +101,9 @@ augment(fit, type.predict = "class") fit2 <- clm(rating ~ temp, nominal = ~contact, data = wine) tidy(fit2) glance(fit2) + +} + } \seealso{ \link{tidy}, \code{\link[ordinal:clm]{ordinal::clm()}}, \code{\link[ordinal:predict]{ordinal::predict.clm()}} diff --git a/man/augment.coxph.Rd b/man/augment.coxph.Rd index dcc4036e6..33803b3e0 100644 --- a/man/augment.coxph.Rd +++ b/man/augment.coxph.Rd @@ -102,6 +102,8 @@ warning is raised and the incomplete rows are dropped. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) cfit <- coxph(Surv(time, status) ~ age + sex, lung) @@ -141,6 +143,9 @@ ggplot(risks, aes(age, .fitted, color = sex)) + ggplot(expected, aes(time, .fitted, color = sex)) + geom_point() + +} + } \seealso{ \link[stats:na.action]{stats::na.action} diff --git a/man/augment.drc.Rd b/man/augment.drc.Rd index 6685d6d4b..b311ae819 100644 --- a/man/augment.drc.Rd +++ b/man/augment.drc.Rd @@ -94,6 +94,8 @@ missing at this time. } \examples{ +if (requireNamespace("drc", quietly = TRUE)) { + library(drc) mod <- drm(dead / total ~ conc, type, @@ -106,6 +108,9 @@ tidy(mod, conf.int = TRUE) glance(mod) augment(mod, selenium) + +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[drc:drm]{drc::drm()}} diff --git a/man/augment.fixest.Rd b/man/augment.fixest.Rd index b7500153a..2ae880761 100644 --- a/man/augment.fixest.Rd +++ b/man/augment.fixest.Rd @@ -91,6 +91,9 @@ augment.fixest only works for \code{\link[fixest:feols]{fixest::feols()}}, \code \code{\link[fixest:femlm]{fixest::fenegbin()}}, \code{\link[fixest:feNmlm]{fixest::feNmlm()}}, or \code{\link[fixest:feglm]{fixest::fepois()}}. } \examples{ + +if (requireNamespace("fixest", quietly = TRUE)) { + \donttest{ library(fixest) @@ -116,6 +119,8 @@ tidy(gravity_summ, conf.int = TRUE) } +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[fixest:feglm]{fixest::feglm()}}, \code{\link[fixest:femlm]{fixest::femlm()}}, \code{\link[fixest:feols]{fixest::feols()}} diff --git a/man/augment.gam.Rd b/man/augment.gam.Rd index a2505de4b..5921c0b0c 100644 --- a/man/augment.gam.Rd +++ b/man/augment.gam.Rd @@ -96,12 +96,17 @@ For additional details on Cook's distance, see } \examples{ +if (requireNamespace("mgcv", quietly = TRUE)) { + g <- mgcv::gam(mpg ~ s(hp) + am + qsec, data = mtcars) tidy(g) tidy(g, parametric = TRUE) glance(g) augment(g) + +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[mgcv:gam]{mgcv::gam()}} diff --git a/man/augment.ivreg.Rd b/man/augment.ivreg.Rd index 2095f404c..e70590e79 100644 --- a/man/augment.ivreg.Rd +++ b/man/augment.ivreg.Rd @@ -80,6 +80,8 @@ objects of class \code{ivreg}, and will be supported in a later release. } \examples{ +if (requireNamespace("AER", quietly = TRUE)) { + library(AER) data("CigarettesSW", package = "AER") @@ -101,6 +103,9 @@ augment(ivr, data = CigarettesSW) augment(ivr, newdata = CigarettesSW) glance(ivr) + +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[AER:ivreg]{AER::ivreg()}} diff --git a/man/augment.mfx.Rd b/man/augment.mfx.Rd index cd5889c81..0c11e631b 100644 --- a/man/augment.mfx.Rd +++ b/man/augment.mfx.Rd @@ -141,6 +141,10 @@ This generic augment method wraps \code{\link[=augment.glm]{augment.glm()}} for objects from the \code{mfx} package. } \examples{ + + +if (requireNamespace("mfx", quietly = TRUE)) { + \dontrun{ library(mfx) @@ -160,6 +164,9 @@ tidy(mod_probmfx, conf.int = TRUE) augment(mod_probmfx) glance(mod_probmfx) } + +} + } \seealso{ \code{\link[=augment.glm]{augment.glm()}}, \code{\link[mfx:logitmfx]{mfx::logitmfx()}}, \code{\link[mfx:negbinmfx]{mfx::negbinmfx()}}, diff --git a/man/augment.mjoint.Rd b/man/augment.mjoint.Rd index eb0bbf0c1..63cb363a1 100644 --- a/man/augment.mjoint.Rd +++ b/man/augment.mjoint.Rd @@ -90,6 +90,9 @@ make sure you are using a named \code{list} to define the formula for the fixed and random effects of the longitudinal submodel. } \examples{ + +if (requireNamespace("joineRML", quietly = TRUE)) { + \dontrun{ # Fit a joint model with bivariate longitudinal outcomes library(joineRML) @@ -132,5 +135,6 @@ hvd2 <- augment(fit) # Extract model statistics glance(fit) } +} } diff --git a/man/augment.mlogit.Rd b/man/augment.mlogit.Rd index e1d690154..e0d1e0d2b 100644 --- a/man/augment.mlogit.Rd +++ b/man/augment.mlogit.Rd @@ -67,6 +67,9 @@ At the moment this only works on the estimation dataset. Need to set it up to predict on another dataset. } \examples{ + +if (requireNamespace("mlogit", quietly = TRUE)) { + \dontrun{ library(mlogit) data("Fishing", package = "mlogit") @@ -78,6 +81,8 @@ augment(m) glance(m) } +} + } \seealso{ \code{\link[=augment]{augment()}} diff --git a/man/augment.poLCA.Rd b/man/augment.poLCA.Rd index 07118b8fd..d32c34e1b 100644 --- a/man/augment.poLCA.Rd +++ b/man/augment.poLCA.Rd @@ -81,6 +81,8 @@ included in the augmented output. } \examples{ +if (requireNamespace("poLCA", quietly = TRUE)) { + library(poLCA) library(dplyr) @@ -126,6 +128,9 @@ count(au, .class) au2 <- augment(nes2a, data = election) au2 dim(au2) + +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[poLCA:poLCA]{poLCA::poLCA()}} diff --git a/man/augment.polr.Rd b/man/augment.polr.Rd index ab816fff9..4218e6329 100644 --- a/man/augment.polr.Rd +++ b/man/augment.polr.Rd @@ -85,6 +85,8 @@ missing at this time. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) fit <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) @@ -97,6 +99,8 @@ augment(fit, type.predict = "class") fit2 <- polr(factor(gear) ~ am + mpg + qsec, data = mtcars) tidy(fit, p.values = TRUE) +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[MASS:polr]{MASS::polr()}} diff --git a/man/augment.rlm.Rd b/man/augment.rlm.Rd index 32bb79cc1..4736a7acc 100644 --- a/man/augment.rlm.Rd +++ b/man/augment.rlm.Rd @@ -79,6 +79,8 @@ missing at this time. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) r <- rlm(stack.loss ~ ., stackloss) @@ -86,6 +88,8 @@ r <- rlm(stack.loss ~ ., stackloss) tidy(r) augment(r) glance(r) + +} } \seealso{ \code{\link[MASS:rlm]{MASS::rlm()}} diff --git a/man/augment.sarlm.Rd b/man/augment.sarlm.Rd index 3db812b28..e97810cd3 100644 --- a/man/augment.sarlm.Rd +++ b/man/augment.sarlm.Rd @@ -71,6 +71,9 @@ original data can be recovered from the fit object, this method currently does not take in \code{data} or \code{newdata} arguments. } \examples{ + +if (requireNamespace("spatialreg", quietly = TRUE)) { + \dontrun{ library(spatialreg) data(oldcol, package = "spdep") @@ -102,6 +105,8 @@ glance(crime_sac) augment(crime_sac) } +} + } \seealso{ \code{\link[=augment]{augment()}} diff --git a/man/augment.speedlm.Rd b/man/augment.speedlm.Rd index 889b5b1fa..8917ef9d8 100644 --- a/man/augment.speedlm.Rd +++ b/man/augment.speedlm.Rd @@ -75,11 +75,16 @@ missing at this time. } \examples{ +if (requireNamespace("speedglm", quietly = TRUE)) { + mod <- speedglm::speedlm(mpg ~ wt + qsec, data = mtcars, fitted = TRUE) tidy(mod) glance(mod) augment(mod) + +} + } \seealso{ \code{\link[speedglm:speedlm]{speedglm::speedlm()}} diff --git a/man/augment.survreg.Rd b/man/augment.survreg.Rd index 11647f1b3..a1c055f4d 100644 --- a/man/augment.survreg.Rd +++ b/man/augment.survreg.Rd @@ -92,6 +92,8 @@ missing at this time. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) sr <- survreg( @@ -111,6 +113,9 @@ ggplot(td, aes(estimate, term)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) + geom_vline(xintercept = 0) + +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[survival:survreg]{survival::survreg()}} diff --git a/man/durbinWatsonTest_tidiers.Rd b/man/durbinWatsonTest_tidiers.Rd index a80c45b33..705e80145 100644 --- a/man/durbinWatsonTest_tidiers.Rd +++ b/man/durbinWatsonTest_tidiers.Rd @@ -31,9 +31,14 @@ of those methods. } \examples{ +if (requireNamespace("car", quietly = TRUE)) { + dw <- car::durbinWatsonTest(lm(mpg ~ wt, data = mtcars)) tidy(dw) glance(dw) # same output for all durbinWatsonTests + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[=glance]{glance()}}, \code{\link[car:durbinWatsonTest]{car::durbinWatsonTest()}} diff --git a/man/glance.Mclust.Rd b/man/glance.Mclust.Rd index 94338b817..40cae3045 100644 --- a/man/glance.Mclust.Rd +++ b/man/glance.Mclust.Rd @@ -42,6 +42,7 @@ of the appropriate type. \examples{ if (requireNamespace("mclust", quietly = TRUE)) { + library(dplyr) library(mclust) set.seed(27) @@ -66,7 +67,9 @@ m <- mclust::Mclust(points) tidy(m) augment(m, points) glance(m) + } + } \value{ A \code{\link[tibble:tibble]{tibble::tibble()}} with exactly one row and columns: diff --git a/man/glance.aareg.Rd b/man/glance.aareg.Rd index 7d42bbbba..8579663e3 100644 --- a/man/glance.aareg.Rd +++ b/man/glance.aareg.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) afit <- aareg( @@ -50,6 +52,9 @@ afit <- aareg( ) tidy(afit) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:aareg]{survival::aareg()}} diff --git a/man/glance.betareg.Rd b/man/glance.betareg.Rd index afd42dadc..7a77752c5 100644 --- a/man/glance.betareg.Rd +++ b/man/glance.betareg.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("betareg", quietly = TRUE)) { + library(betareg) data("GasolineYield", package = "betareg") @@ -54,6 +56,9 @@ tidy(mod, conf.int = TRUE, conf.level = .99) augment(mod) glance(mod) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[betareg:betareg]{betareg::betareg()}} diff --git a/man/glance.binDesign.Rd b/man/glance.binDesign.Rd index 7d9a7bf30..a50749321 100644 --- a/man/glance.binDesign.Rd +++ b/man/glance.binDesign.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("binGroup", quietly = TRUE)) { + library(binGroup) des <- binDesign( nmax = 300, delta = 0.06, @@ -53,6 +55,9 @@ tidy(des) library(ggplot2) ggplot(tidy(des), aes(n, power)) + geom_line() + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[binGroup:binDesign]{binGroup::binDesign()}} diff --git a/man/glance.cch.Rd b/man/glance.cch.Rd index 70422201c..9d6de3e93 100644 --- a/man/glance.cch.Rd +++ b/man/glance.cch.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) # examples come from cch documentation @@ -67,6 +69,9 @@ ggplot(tidy(fit.ccP), aes(x = estimate, y = term)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) + geom_vline(xintercept = 0) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:cch]{survival::cch()}} diff --git a/man/glance.clm.Rd b/man/glance.clm.Rd index 46605e0cb..1b3b09e1e 100644 --- a/man/glance.clm.Rd +++ b/man/glance.clm.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("ordinal", quietly = TRUE)) { + library(ordinal) fit <- clm(rating ~ temp * contact, data = wine) @@ -56,6 +58,9 @@ augment(fit, type.predict = "class") fit2 <- clm(rating ~ temp, nominal = ~contact, data = wine) tidy(fit2) glance(fit2) + +} + } \seealso{ \link{tidy}, \code{\link[ordinal:clm]{ordinal::clm()}} diff --git a/man/glance.clmm.Rd b/man/glance.clmm.Rd index 0f322873f..8e3e9cbc3 100644 --- a/man/glance.clmm.Rd +++ b/man/glance.clmm.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("ordinal", quietly = TRUE)) { + library(ordinal) fit <- clmm(rating ~ temp + contact + (1 | judge), data = wine) @@ -54,6 +56,9 @@ glance(fit) fit2 <- clmm(rating ~ temp + (1 | judge), nominal = ~contact, data = wine) tidy(fit2) glance(fit2) + +} + } \seealso{ \link{tidy}, \code{\link[ordinal:clmm]{ordinal::clmm()}} diff --git a/man/glance.coeftest.Rd b/man/glance.coeftest.Rd index a2494d271..87f7d68aa 100644 --- a/man/glance.coeftest.Rd +++ b/man/glance.coeftest.Rd @@ -53,6 +53,8 @@ of Wooldridge (2016). } \examples{ +if (requireNamespace("lmtest", quietly = TRUE)) { + library(lmtest) m <- lm(dist ~ speed, data = cars) @@ -75,6 +77,9 @@ tidy(coeftest(m, vcov = NeweyWest)) # N-W HAC robust SEs # Users can control this with the "save = TRUE" argument of coeftest(). glance(coeftest(m)) glance(coeftest(m, save = TRUE)) # More columns + +} + } \references{ Wooldridge, Jeffrey M. (2016) \cite{Introductory econometrics: A diff --git a/man/glance.coxph.Rd b/man/glance.coxph.Rd index 21f0b8840..875f2e3f7 100644 --- a/man/glance.coxph.Rd +++ b/man/glance.coxph.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) cfit <- coxph(Surv(time, status) ~ age + sex, lung) @@ -80,6 +82,9 @@ ggplot(risks, aes(age, .fitted, color = sex)) + ggplot(expected, aes(time, .fitted, color = sex)) + geom_point() + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:coxph]{survival::coxph()}} diff --git a/man/glance.crr.Rd b/man/glance.crr.Rd index b2c049ac9..effdc9e6b 100644 --- a/man/glance.crr.Rd +++ b/man/glance.crr.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("cmprsk", quietly = TRUE)) { + library(cmprsk) lrf_time <- rexp(100) #time to loco-regional failure (lrf) lrf_event <- sample(0:2, 100, replace = TRUE) @@ -50,6 +52,8 @@ x <- crr(lrf_time, lrf_event, cbind(trt, strt)) tidy(x, conf.int = TRUE) glance(x) +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[cmprsk:crr]{cmprsk::crr()}} diff --git a/man/glance.cv.glmnet.Rd b/man/glance.cv.glmnet.Rd index 20abf0772..c88e43250 100644 --- a/man/glance.cv.glmnet.Rd +++ b/man/glance.cv.glmnet.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("glmnet", quietly = TRUE)) { + library(glmnet) set.seed(27) @@ -91,6 +93,9 @@ ggplot(tidied, aes(lambda, estimate, group = term)) + geom_line() + geom_vline(xintercept = glance_cv$lambda.min) + geom_vline(xintercept = glance_cv$lambda.1se, lty = 2) + + } + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[glmnet:cv.glmnet]{glmnet::cv.glmnet()}} diff --git a/man/glance.drc.Rd b/man/glance.drc.Rd index 90d8df8ef..144b86d2d 100644 --- a/man/glance.drc.Rd +++ b/man/glance.drc.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("drc", quietly = TRUE)) { + library(drc) mod <- drm(dead / total ~ conc, type, @@ -53,6 +55,9 @@ tidy(mod, conf.int = TRUE) glance(mod) augment(mod, selenium) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[drc:drm]{drc::drm()}} diff --git a/man/glance.fitdistr.Rd b/man/glance.fitdistr.Rd index 5d7ecb263..2113c1b25 100644 --- a/man/glance.fitdistr.Rd +++ b/man/glance.fitdistr.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + set.seed(2015) x <- rnorm(100, 5, 2) @@ -49,6 +51,9 @@ fit <- fitdistr(x, dnorm, list(mean = 3, sd = 1)) tidy(fit) glance(fit) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[MASS:fitdistr]{MASS::fitdistr()}} diff --git a/man/glance.fixest.Rd b/man/glance.fixest.Rd index 4df628694..1263fe1d9 100644 --- a/man/glance.fixest.Rd +++ b/man/glance.fixest.Rd @@ -41,6 +41,9 @@ depending on the type of model estimated. \code{sigma}, \code{r.squared}, \code{feols}. \code{pseudo.r.squared} will be NA for \code{feols}. } \examples{ + +if (requireNamespace("fixest", quietly = TRUE)) { + \donttest{ library(fixest) @@ -66,6 +69,8 @@ tidy(gravity_summ, conf.int = TRUE) } +} + } \value{ A \code{\link[tibble:tibble]{tibble::tibble()}} with exactly one row and columns: diff --git a/man/glance.gam.Rd b/man/glance.gam.Rd index c771ce14f..99b8a3f49 100644 --- a/man/glance.gam.Rd +++ b/man/glance.gam.Rd @@ -41,12 +41,17 @@ of the appropriate type. } \examples{ +if (requireNamespace("mgcv", quietly = TRUE)) { + g <- mgcv::gam(mpg ~ s(hp) + am + qsec, data = mtcars) tidy(g) tidy(g, parametric = TRUE) glance(g) augment(g) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[mgcv:gam]{mgcv::gam()}} diff --git a/man/glance.geeglm.Rd b/man/glance.geeglm.Rd index 7a51e5a5b..784c184b6 100644 --- a/man/glance.geeglm.Rd +++ b/man/glance.geeglm.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("geepack", quietly = TRUE)) { + library(geepack) data(state) @@ -54,6 +56,9 @@ geefit <- geeglm(Income ~ Frost + Murder, tidy(geefit) tidy(geefit, conf.int = TRUE) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[geepack:geeglm]{geepack::geeglm()}} diff --git a/man/glance.glmnet.Rd b/man/glance.glmnet.Rd index 1c3b226ba..16ef64e4f 100644 --- a/man/glance.glmnet.Rd +++ b/man/glance.glmnet.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("glmnet", quietly = TRUE)) { + library(glmnet) set.seed(2014) @@ -69,6 +71,9 @@ ggplot(tidied, aes(lambda, dev.ratio)) + g2 <- sample(1:2, 100, replace = TRUE) fit2 <- glmnet(x, g2, family = "binomial") tidy(fit2) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[glmnet:glmnet]{glmnet::glmnet()}} diff --git a/man/glance.gmm.Rd b/man/glance.gmm.Rd index 338888b41..70c92e753 100644 --- a/man/glance.gmm.Rd +++ b/man/glance.gmm.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("gmm", quietly = TRUE)) { + library(gmm) # examples come from the "gmm" package @@ -103,6 +105,9 @@ td2 \%>\% geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + geom_vline(xintercept = 0, color = "red", lty = 2) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[gmm:gmm]{gmm::gmm()}} diff --git a/man/glance.ivreg.Rd b/man/glance.ivreg.Rd index 7935b7f91..69d8493a7 100644 --- a/man/glance.ivreg.Rd +++ b/man/glance.ivreg.Rd @@ -56,6 +56,8 @@ endogenous regressors. } \examples{ +if (requireNamespace("AER", quietly = TRUE)) { + library(AER) data("CigarettesSW", package = "AER") @@ -77,6 +79,9 @@ augment(ivr, data = CigarettesSW) augment(ivr, newdata = CigarettesSW) glance(ivr) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[AER:ivreg]{AER::ivreg()}} diff --git a/man/glance.lmodel2.Rd b/man/glance.lmodel2.Rd index eba5790ec..f34b06922 100644 --- a/man/glance.lmodel2.Rd +++ b/man/glance.lmodel2.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("lmodel2", quietly = TRUE)) { + library(lmodel2) data(mod2ex2) @@ -56,6 +58,9 @@ ggplot(tidy(Ex2.res), aes(estimate, term, color = method)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[lmodel2:lmodel2]{lmodel2::lmodel2()}} diff --git a/man/glance.margins.Rd b/man/glance.margins.Rd index 02204ead4..d19a48f85 100644 --- a/man/glance.margins.Rd +++ b/man/glance.margins.Rd @@ -40,6 +40,9 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ + +if (requireNamespace("margins", quietly = TRUE)) { + library(margins) ## Example 1: Logit model ## @@ -82,6 +85,9 @@ marg_ie2 <- margins(mod_ie, variables = "wt", ## Main var at = list(cyl = c(4,6,8), drat = c(3, 3.5, 4))) ## Modulating vars tidy(marg_ie2) + +} + } \value{ A \code{\link[tibble:tibble]{tibble::tibble()}} with exactly one row and columns: diff --git a/man/glance.mfx.Rd b/man/glance.mfx.Rd index dfec4492a..7270274ad 100644 --- a/man/glance.mfx.Rd +++ b/man/glance.mfx.Rd @@ -56,6 +56,10 @@ This generic glance method wraps \code{\link[=glance.glm]{glance.glm()}} for app objects from the \code{mfx} package. } \examples{ + + +if (requireNamespace("mfx", quietly = TRUE)) { + \dontrun{ library(mfx) @@ -75,6 +79,9 @@ tidy(mod_probmfx, conf.int = TRUE) augment(mod_probmfx) glance(mod_probmfx) } + +} + } \seealso{ \code{\link[=glance.glm]{glance.glm()}}, \code{\link[mfx:logitmfx]{mfx::logitmfx()}}, \code{\link[mfx:negbinmfx]{mfx::negbinmfx()}}, diff --git a/man/glance.mjoint.Rd b/man/glance.mjoint.Rd index b202c92bb..3207d1f99 100644 --- a/man/glance.mjoint.Rd +++ b/man/glance.mjoint.Rd @@ -40,6 +40,9 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ + +if (requireNamespace("joineRML", quietly = TRUE)) { + \dontrun{ # Fit a joint model with bivariate longitudinal outcomes library(joineRML) @@ -82,6 +85,7 @@ hvd2 <- augment(fit) # Extract model statistics glance(fit) } +} } \seealso{ diff --git a/man/glance.mlogit.Rd b/man/glance.mlogit.Rd index d9b12a44c..23f38b109 100644 --- a/man/glance.mlogit.Rd +++ b/man/glance.mlogit.Rd @@ -40,6 +40,9 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ + +if (requireNamespace("mlogit", quietly = TRUE)) { + \dontrun{ library(mlogit) data("Fishing", package = "mlogit") @@ -51,6 +54,8 @@ augment(m) glance(m) } +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[mlogit:mlogit]{mlogit::mlogit()}} diff --git a/man/glance.muhaz.Rd b/man/glance.muhaz.Rd index 56753e7f1..c470bf658 100644 --- a/man/glance.muhaz.Rd +++ b/man/glance.muhaz.Rd @@ -40,12 +40,20 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ + +if (requireNamespace("muhaz", quietly = TRUE)) { + if (requireNamespace("survival", quietly = TRUE)) { + library(muhaz) library(survival) x <- muhaz(ovarian$futime, ovarian$fustat) tidy(x) glance(x) + + } +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[muhaz:muhaz]{muhaz::muhaz()}} diff --git a/man/glance.multinom.Rd b/man/glance.multinom.Rd index 0c4ce9532..b6dc6c647 100644 --- a/man/glance.multinom.Rd +++ b/man/glance.multinom.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("nnet", quietly = TRUE)) { + library(nnet) library(MASS) @@ -56,6 +58,9 @@ glance(bwt.mu) fit.gear <- multinom(gear ~ mpg + factor(am), data = mtcars) tidy(fit.gear) glance(fit.gear) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[nnet:multinom]{nnet::multinom()}} diff --git a/man/glance.negbin.Rd b/man/glance.negbin.Rd index 15f5b6d45..2b7d0a6d8 100644 --- a/man/glance.negbin.Rd +++ b/man/glance.negbin.Rd @@ -41,6 +41,9 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ + +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) r <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine) @@ -48,6 +51,8 @@ r <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine) tidy(r) glance(r) +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[MASS:glm.nb]{MASS::glm.nb()}} diff --git a/man/glance.orcutt.Rd b/man/glance.orcutt.Rd index 358a5e40f..01af320d1 100644 --- a/man/glance.orcutt.Rd +++ b/man/glance.orcutt.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("orcutt", quietly = TRUE)) { + library(orcutt) reg <- lm(mpg ~ wt + qsec + disp, mtcars) @@ -51,6 +53,9 @@ co tidy(co) glance(co) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[orcutt:cochrane.orcutt]{orcutt::cochrane.orcutt()}} diff --git a/man/glance.poLCA.Rd b/man/glance.poLCA.Rd index a53a6cf13..6013f9fdc 100644 --- a/man/glance.poLCA.Rd +++ b/man/glance.poLCA.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("poLCA", quietly = TRUE)) { + library(poLCA) library(dplyr) @@ -86,6 +88,9 @@ count(au, .class) au2 <- augment(nes2a, data = election) au2 dim(au2) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[poLCA:poLCA]{poLCA::poLCA()}} diff --git a/man/glance.polr.Rd b/man/glance.polr.Rd index 18fb43798..6dfbe1957 100644 --- a/man/glance.polr.Rd +++ b/man/glance.polr.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) fit <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) @@ -53,6 +55,8 @@ augment(fit, type.predict = "class") fit2 <- polr(factor(gear) ~ am + mpg + qsec, data = mtcars) tidy(fit, p.values = TRUE) +} + } \seealso{ \link{tidy}, \code{\link[MASS:polr]{MASS::polr()}} diff --git a/man/glance.pyears.Rd b/man/glance.pyears.Rd index c004c8c28..6258234e3 100644 --- a/man/glance.pyears.Rd +++ b/man/glance.pyears.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) temp.yr <- tcut(mgus$dxyr, 55:92, labels = as.character(55:91)) @@ -58,6 +60,9 @@ glance(pfit) pfit2 <- pyears(Surv(ptime / 365.25, pstat) ~ temp.yr + temp.age + sex, mgus) tidy(pfit2) glance(pfit2) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:pyears]{survival::pyears()}} diff --git a/man/glance.ridgelm.Rd b/man/glance.ridgelm.Rd index 3329292a4..77809df2f 100644 --- a/man/glance.ridgelm.Rd +++ b/man/glance.ridgelm.Rd @@ -45,6 +45,9 @@ returned rather than printed. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + + names(longley)[1] <- "y" fit1 <- MASS::lm.ridge(y ~ ., longley) tidy(fit1) @@ -66,6 +69,9 @@ ggplot(td2, aes(lambda, GCV)) + ggplot(td2, aes(lambda, GCV)) + geom_line() + geom_vline(xintercept = g2$lambdaGCV, col = "red", lty = 2) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[MASS:lm.ridge]{MASS::select.ridgelm()}}, \code{\link[MASS:lm.ridge]{MASS::lm.ridge()}} diff --git a/man/glance.rlm.Rd b/man/glance.rlm.Rd index 36f180fff..8f4b796bd 100644 --- a/man/glance.rlm.Rd +++ b/man/glance.rlm.Rd @@ -42,6 +42,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) r <- rlm(stack.loss ~ ., stackloss) @@ -49,6 +51,8 @@ r <- rlm(stack.loss ~ ., stackloss) tidy(r) augment(r) glance(r) + +} } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[MASS:rlm]{MASS::rlm()}} diff --git a/man/glance.sarlm.Rd b/man/glance.sarlm.Rd index 42512bc24..a39d358e0 100644 --- a/man/glance.sarlm.Rd +++ b/man/glance.sarlm.Rd @@ -41,6 +41,9 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ + +if (requireNamespace("spatialreg", quietly = TRUE)) { + \dontrun{ library(spatialreg) data(oldcol, package = "spdep") @@ -72,6 +75,8 @@ glance(crime_sac) augment(crime_sac) } +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[spatialreg:ML_models]{spatialreg::lagsarlm()}}, \code{\link[spatialreg:ML_models]{spatialreg::errorsarlm()}}, diff --git a/man/glance.speedglm.Rd b/man/glance.speedglm.Rd index 8fa322a8f..69a6dc93f 100644 --- a/man/glance.speedglm.Rd +++ b/man/glance.speedglm.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("speedglm", quietly = TRUE)) { + library(speedglm) clotting <- data.frame( @@ -52,6 +54,9 @@ fit <- speedglm(lot1 ~ log(u), data = clotting, family = Gamma(log)) tidy(fit) glance(fit) + +} + } \seealso{ \code{\link[speedglm:speedlm]{speedglm::speedlm()}} diff --git a/man/glance.speedlm.Rd b/man/glance.speedlm.Rd index db32cd18c..36521129b 100644 --- a/man/glance.speedlm.Rd +++ b/man/glance.speedlm.Rd @@ -41,11 +41,16 @@ of the appropriate type. } \examples{ +if (requireNamespace("speedglm", quietly = TRUE)) { + mod <- speedglm::speedlm(mpg ~ wt + qsec, data = mtcars, fitted = TRUE) tidy(mod) glance(mod) augment(mod) + +} + } \seealso{ \code{\link[speedglm:speedlm]{speedglm::speedlm()}} diff --git a/man/glance.survdiff.Rd b/man/glance.survdiff.Rd index 301a1abcd..0efb63273 100644 --- a/man/glance.survdiff.Rd +++ b/man/glance.survdiff.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) s <- survdiff( @@ -50,6 +52,9 @@ s <- survdiff( tidy(s) glance(s) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:survdiff]{survival::survdiff()}} diff --git a/man/glance.survexp.Rd b/man/glance.survexp.Rd index e50ba0268..eb4e48ddf 100644 --- a/man/glance.survexp.Rd +++ b/man/glance.survexp.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) sexpfit <- survexp( futime ~ 1, @@ -55,6 +57,9 @@ sexpfit <- survexp( tidy(sexpfit) glance(sexpfit) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:survexp]{survival::survexp()}} diff --git a/man/glance.survfit.Rd b/man/glance.survfit.Rd index c0ad05b1f..46491dde9 100644 --- a/man/glance.survfit.Rd +++ b/man/glance.survfit.Rd @@ -34,6 +34,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) cfit <- coxph(Surv(time, status) ~ age + sex, lung) sfit <- survfit(cfit) @@ -56,6 +58,9 @@ td_multi ggplot(td_multi, aes(time, estimate, group = state)) + geom_line(aes(color = state)) + geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:survfit]{survival::survfit()}} diff --git a/man/glance.survreg.Rd b/man/glance.survreg.Rd index a0e3476a3..e9d172511 100644 --- a/man/glance.survreg.Rd +++ b/man/glance.survreg.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) sr <- survreg( @@ -60,6 +62,9 @@ ggplot(td, aes(estimate, term)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) + geom_vline(xintercept = 0) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[survival:survreg]{survival::survreg()}} diff --git a/man/glance.svyolr.Rd b/man/glance.svyolr.Rd index 500e1e48e..1d747dc26 100644 --- a/man/glance.svyolr.Rd +++ b/man/glance.svyolr.Rd @@ -41,12 +41,17 @@ of the appropriate type. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) fit <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) tidy(fit, exponentiate = TRUE, conf.int = TRUE) glance(fit) + +} + } \seealso{ \link{tidy}, \code{\link[survey:svyolr]{survey::svyolr()}} diff --git a/man/glance.varest.Rd b/man/glance.varest.Rd index aa113b99d..a9bc5ea67 100644 --- a/man/glance.varest.Rd +++ b/man/glance.varest.Rd @@ -40,6 +40,9 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ + +if (requireNamespace("vars", quietly = TRUE)) { + library(vars) data("Canada", package = "vars") @@ -47,6 +50,9 @@ mod <- VAR(Canada, p = 1, type = "both") tidy(mod) glance(mod) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[vars:VAR]{vars::VAR()}} diff --git a/man/metafor_tidiers.Rd b/man/metafor_tidiers.Rd index 3a6db0beb..669ebee57 100644 --- a/man/metafor_tidiers.Rd +++ b/man/metafor_tidiers.Rd @@ -56,6 +56,8 @@ specify which components to return. } \examples{ +if (requireNamespace("metafor", quietly = TRUE)) { + library(metafor) df <- @@ -71,6 +73,9 @@ df <- meta_analysis <- rma(yi, vi, data = df, method = "EB") tidy(meta_analysis) + +} + } \value{ A \code{\link[tibble:tibble]{tibble::tibble()}} with columns: diff --git a/man/tidy.Kendall.Rd b/man/tidy.Kendall.Rd index 54253c822..a339831f7 100644 --- a/man/tidy.Kendall.Rd +++ b/man/tidy.Kendall.Rd @@ -31,6 +31,9 @@ If a model has several distinct types of components, you will need to specify which components to return. } \examples{ + +if (requireNamespace("Kendall", quietly = TRUE)) { + library(Kendall) A <- c(2.5, 2.5, 2.5, 2.5, 5, 6.5, 6.5, 10, 10, 10, 10, 10, 14, 14, 14, 16, 17) @@ -44,6 +47,9 @@ tidy(s_res) t_res <- SeasonalMannKendall(ts(A)) tidy(t_res) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[Kendall:Kendall]{Kendall::Kendall()}}, \code{\link[Kendall:MannKendall]{Kendall::MannKendall()}}, diff --git a/man/tidy.Mclust.Rd b/man/tidy.Mclust.Rd index 0b685fb5a..446968297 100644 --- a/man/tidy.Mclust.Rd +++ b/man/tidy.Mclust.Rd @@ -31,6 +31,7 @@ specify which components to return. \examples{ if (requireNamespace("mclust", quietly = TRUE)) { + library(dplyr) library(mclust) set.seed(27) @@ -55,7 +56,9 @@ m <- mclust::Mclust(points) tidy(m) augment(m, points) glance(m) + } + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[mclust:Mclust]{mclust::Mclust()}} diff --git a/man/tidy.aareg.Rd b/man/tidy.aareg.Rd index 0c73a21bd..058bdb81f 100644 --- a/man/tidy.aareg.Rd +++ b/man/tidy.aareg.Rd @@ -34,6 +34,8 @@ specify which components to return. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) afit <- aareg( @@ -43,6 +45,9 @@ afit <- aareg( ) tidy(afit) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:aareg]{survival::aareg()}} diff --git a/man/tidy.betareg.Rd b/man/tidy.betareg.Rd index 35f1e96f7..27c565524 100644 --- a/man/tidy.betareg.Rd +++ b/man/tidy.betareg.Rd @@ -44,6 +44,8 @@ At least one term will have been used to model the precision \code{phi}. } \examples{ +if (requireNamespace("betareg", quietly = TRUE)) { + library(betareg) data("GasolineYield", package = "betareg") @@ -57,6 +59,9 @@ tidy(mod, conf.int = TRUE, conf.level = .99) augment(mod) glance(mod) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[betareg:betareg]{betareg::betareg()}} diff --git a/man/tidy.binDesign.Rd b/man/tidy.binDesign.Rd index 65ae3e60c..f1943c8a3 100644 --- a/man/tidy.binDesign.Rd +++ b/man/tidy.binDesign.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("binGroup", quietly = TRUE)) { + library(binGroup) des <- binDesign( nmax = 300, delta = 0.06, @@ -43,6 +45,9 @@ tidy(des) library(ggplot2) ggplot(tidy(des), aes(n, power)) + geom_line() + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[binGroup:binDesign]{binGroup::binDesign()}} diff --git a/man/tidy.binWidth.Rd b/man/tidy.binWidth.Rd index 311c9298f..f2e72c697 100644 --- a/man/tidy.binWidth.Rd +++ b/man/tidy.binWidth.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("binGroup", quietly = TRUE)) { + library(binGroup) library(dplyr) library(ggplot2) @@ -37,6 +39,9 @@ library(ggplot2) bw <- binWidth(100, .1) bw tidy(bw) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[binGroup:binWidth]{binGroup::binWidth()}} diff --git a/man/tidy.boot.Rd b/man/tidy.boot.Rd index f69a11851..c94b194db 100644 --- a/man/tidy.boot.Rd +++ b/man/tidy.boot.Rd @@ -57,6 +57,8 @@ and \code{statistic} columns are omitted, and only \code{estimate} and } \examples{ +if (requireNamespace("boot", quietly = TRUE)) { + library(boot) clotting <- data.frame( @@ -74,6 +76,9 @@ bootfun <- function(d, i) { bootres <- boot(clotting, bootfun, R = 999) tidy(g1, conf.int = TRUE) tidy(bootres, conf.int = TRUE) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[boot:boot]{boot::boot()}}, \code{\link[boot:tsboot]{boot::tsboot()}}, \code{\link[boot:boot.ci]{boot::boot.ci()}}, diff --git a/man/tidy.cch.Rd b/man/tidy.cch.Rd index 2b7cdaf45..22ba3e68d 100644 --- a/man/tidy.cch.Rd +++ b/man/tidy.cch.Rd @@ -32,6 +32,8 @@ specify which components to return. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) # examples come from cch documentation @@ -58,6 +60,9 @@ ggplot(tidy(fit.ccP), aes(x = estimate, y = term)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) + geom_vline(xintercept = 0) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:cch]{survival::cch()}} diff --git a/man/tidy.cld.Rd b/man/tidy.cld.Rd index 522327817..847d096cc 100644 --- a/man/tidy.cld.Rd +++ b/man/tidy.cld.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("multcomp", quietly = TRUE)) { + library(multcomp) library(ggplot2) @@ -53,6 +55,9 @@ ggplot(mapping = aes(lhs, estimate)) + cld <- cld(wht) tidy(cld) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[multcomp:cld]{multcomp::cld()}}, \code{\link[multcomp:methods]{multcomp::summary.glht()}}, diff --git a/man/tidy.clm.Rd b/man/tidy.clm.Rd index 64a7ef68a..507a3d7cc 100644 --- a/man/tidy.clm.Rd +++ b/man/tidy.clm.Rd @@ -62,6 +62,8 @@ parameters. } \examples{ +if (requireNamespace("ordinal", quietly = TRUE)) { + library(ordinal) fit <- clm(rating ~ temp * contact, data = wine) @@ -77,6 +79,9 @@ augment(fit, type.predict = "class") fit2 <- clm(rating ~ temp, nominal = ~contact, data = wine) tidy(fit2) glance(fit2) + +} + } \seealso{ \link{tidy}, \code{\link[ordinal:clm]{ordinal::clm()}}, \code{\link[ordinal:confint.clm]{ordinal::confint.clm()}} diff --git a/man/tidy.clmm.Rd b/man/tidy.clmm.Rd index c14935f0f..83599a597 100644 --- a/man/tidy.clmm.Rd +++ b/man/tidy.clmm.Rd @@ -50,6 +50,8 @@ parameters. } \examples{ +if (requireNamespace("ordinal", quietly = TRUE)) { + library(ordinal) fit <- clmm(rating ~ temp + contact + (1 | judge), data = wine) @@ -63,6 +65,9 @@ glance(fit) fit2 <- clmm(rating ~ temp + (1 | judge), nominal = ~contact, data = wine) tidy(fit2) glance(fit2) + +} + } \seealso{ \link{tidy}, \code{\link[ordinal:clmm]{ordinal::clmm()}}, \code{\link[ordinal:confint.clm]{ordinal::confint.clm()}} diff --git a/man/tidy.coeftest.Rd b/man/tidy.coeftest.Rd index 3ae89e67d..463b37359 100644 --- a/man/tidy.coeftest.Rd +++ b/man/tidy.coeftest.Rd @@ -38,6 +38,8 @@ specify which components to return. } \examples{ +if (requireNamespace("lmtest", quietly = TRUE)) { + library(lmtest) m <- lm(dist ~ speed, data = cars) @@ -60,6 +62,9 @@ tidy(coeftest(m, vcov = NeweyWest)) # N-W HAC robust SEs # Users can control this with the "save = TRUE" argument of coeftest(). glance(coeftest(m)) glance(coeftest(m, save = TRUE)) # More columns + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[lmtest:coeftest]{lmtest::coeftest()}} diff --git a/man/tidy.confint.glht.Rd b/man/tidy.confint.glht.Rd index cb4b8b2d4..2ce97b68c 100644 --- a/man/tidy.confint.glht.Rd +++ b/man/tidy.confint.glht.Rd @@ -31,6 +31,8 @@ specify which components to return. } \examples{ +if (requireNamespace("multcomp", quietly = TRUE)) { + library(multcomp) library(ggplot2) @@ -54,6 +56,9 @@ ggplot(mapping = aes(lhs, estimate)) + cld <- cld(wht) tidy(cld) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[multcomp:methods]{multcomp::confint.glht()}}, \code{\link[multcomp:glht]{multcomp::glht()}} diff --git a/man/tidy.confusionMatrix.Rd b/man/tidy.confusionMatrix.Rd index 62e2e4f5c..d72ab49c2 100644 --- a/man/tidy.confusionMatrix.Rd +++ b/man/tidy.confusionMatrix.Rd @@ -36,6 +36,8 @@ specify which components to return. } \examples{ +if (requireNamespace("caret", quietly = TRUE)) { + library(caret) set.seed(27) @@ -63,6 +65,9 @@ six_class_cm <- caret::confusionMatrix( tidy(six_class_cm) tidy(six_class_cm, by_class = FALSE) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[caret:confusionMatrix]{caret::confusionMatrix()}} diff --git a/man/tidy.coxph.Rd b/man/tidy.coxph.Rd index 67cd44932..463478ab3 100644 --- a/man/tidy.coxph.Rd +++ b/man/tidy.coxph.Rd @@ -42,6 +42,8 @@ specify which components to return. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) cfit <- coxph(Surv(time, status) ~ age + sex, lung) @@ -81,6 +83,9 @@ ggplot(risks, aes(age, .fitted, color = sex)) + ggplot(expected, aes(time, .fitted, color = sex)) + geom_point() + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:coxph]{survival::coxph()}} diff --git a/man/tidy.crr.Rd b/man/tidy.crr.Rd index 8112e7aa5..4ef34b761 100644 --- a/man/tidy.crr.Rd +++ b/man/tidy.crr.Rd @@ -42,6 +42,8 @@ specify which components to return. } \examples{ +if (requireNamespace("cmprsk", quietly = TRUE)) { + library(cmprsk) lrf_time <- rexp(100) #time to loco-regional failure (lrf) lrf_event <- sample(0:2, 100, replace = TRUE) @@ -51,6 +53,8 @@ x <- crr(lrf_time, lrf_event, cbind(trt, strt)) tidy(x, conf.int = TRUE) glance(x) +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[cmprsk:crr]{cmprsk::crr()}} diff --git a/man/tidy.cv.glmnet.Rd b/man/tidy.cv.glmnet.Rd index 4530ceca5..70f15d1c8 100644 --- a/man/tidy.cv.glmnet.Rd +++ b/man/tidy.cv.glmnet.Rd @@ -29,6 +29,8 @@ specify which components to return. } \examples{ +if (requireNamespace("glmnet", quietly = TRUE)) { + library(glmnet) set.seed(27) @@ -79,6 +81,9 @@ ggplot(tidied, aes(lambda, estimate, group = term)) + geom_line() + geom_vline(xintercept = glance_cv$lambda.min) + geom_vline(xintercept = glance_cv$lambda.1se, lty = 2) + + } + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[glmnet:cv.glmnet]{glmnet::cv.glmnet()}} diff --git a/man/tidy.drc.Rd b/man/tidy.drc.Rd index 0780e2eed..aecbd9690 100644 --- a/man/tidy.drc.Rd +++ b/man/tidy.drc.Rd @@ -41,6 +41,8 @@ The \code{curveid} column indicates the curve. } \examples{ +if (requireNamespace("drc", quietly = TRUE)) { + library(drc) mod <- drm(dead / total ~ conc, type, @@ -53,6 +55,9 @@ tidy(mod, conf.int = TRUE) glance(mod) augment(mod, selenium) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[drc:drm]{drc::drm()}} diff --git a/man/tidy.emmGrid.Rd b/man/tidy.emmGrid.Rd index cad8ca626..0dff0c342 100644 --- a/man/tidy.emmGrid.Rd +++ b/man/tidy.emmGrid.Rd @@ -38,6 +38,8 @@ passed on to \code{\link[emmeans:summary.emmGrid]{emmeans::summary.emmGrid()}} o } \examples{ +if (requireNamespace("emmeans", quietly = TRUE)) { + library(emmeans) # linear model for sales of oranges per day oranges_lm1 <- lm(sales1 ~ price1 + price2 + day + store, data = oranges) @@ -78,6 +80,9 @@ ggplot(tidy(by_price, conf.int = TRUE), aes(price2, estimate, color = day)) + # joint_tests tidy(joint_tests(oranges_lm1)) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[emmeans:ref_grid]{emmeans::ref_grid()}}, \code{\link[emmeans:emmeans]{emmeans::emmeans()}}, diff --git a/man/tidy.epi.2by2.Rd b/man/tidy.epi.2by2.Rd index e0a63ba71..3e49a558e 100644 --- a/man/tidy.epi.2by2.Rd +++ b/man/tidy.epi.2by2.Rd @@ -37,6 +37,8 @@ or tests contained in \code{massoc} or \code{massoc.detail} when \code{\link[epi } \examples{ +if (requireNamespace("epiR", quietly = TRUE)) { + library(epiR) dat <- matrix(c(13, 2163, 5, 3349), nrow = 2, byrow = TRUE) @@ -52,6 +54,8 @@ fit <- epi.2by2( tidy(fit, parameters = "moa") tidy(fit, parameters = "stat") +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[epiR:epi.2by2]{epiR::epi.2by2()}} diff --git a/man/tidy.ergm.Rd b/man/tidy.ergm.Rd index bd1c56920..2001f2b71 100644 --- a/man/tidy.ergm.Rd +++ b/man/tidy.ergm.Rd @@ -48,6 +48,8 @@ the \pkg{ergm} class, such as those produced from weighted networks by the } \examples{ +if (requireNamespace("ergm", quietly = TRUE)) { + library(ergm) # Using the same example as the ergm package # Load the Florentine marriage network data @@ -69,6 +71,8 @@ glance(gest) glance(gest, deviance = TRUE) glance(gest, mcmc = TRUE) +} + } \references{ Hunter DR, Handcock MS, Butts CT, Goodreau SM, Morris M (2008b). diff --git a/man/tidy.fitdistr.Rd b/man/tidy.fitdistr.Rd index 8f7c4a7a2..7ad99fb74 100644 --- a/man/tidy.fitdistr.Rd +++ b/man/tidy.fitdistr.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + set.seed(2015) x <- rnorm(100, 5, 2) @@ -38,6 +40,9 @@ fit <- fitdistr(x, dnorm, list(mean = 3, sd = 1)) tidy(fit) glance(fit) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[MASS:fitdistr]{MASS::fitdistr()}} diff --git a/man/tidy.fixest.Rd b/man/tidy.fixest.Rd index 49fcfa587..b05dc6a8d 100644 --- a/man/tidy.fixest.Rd +++ b/man/tidy.fixest.Rd @@ -47,6 +47,9 @@ fixed effects, see \url{https://github.com/lrberge/fixest/issues/6} and \url{https://github.com/sgaure/lfe/issues/1#issuecomment-530646990}) } \examples{ + +if (requireNamespace("fixest", quietly = TRUE)) { + \donttest{ library(fixest) @@ -72,6 +75,8 @@ tidy(gravity_summ, conf.int = TRUE) } +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[fixest:feglm]{fixest::feglm()}}, \code{\link[fixest:femlm]{fixest::fenegbin()}}, diff --git a/man/tidy.gam.Rd b/man/tidy.gam.Rd index 026c159e1..7e848c33d 100644 --- a/man/tidy.gam.Rd +++ b/man/tidy.gam.Rd @@ -58,12 +58,17 @@ than \code{estimate} and \code{std.error}. } \examples{ +if (requireNamespace("mgcv", quietly = TRUE)) { + g <- mgcv::gam(mpg ~ s(hp) + am + qsec, data = mtcars) tidy(g) tidy(g, parametric = TRUE) glance(g) augment(g) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[mgcv:gam]{mgcv::gam()}} diff --git a/man/tidy.garch.Rd b/man/tidy.garch.Rd index c103da12d..99ea004d7 100644 --- a/man/tidy.garch.Rd +++ b/man/tidy.garch.Rd @@ -37,6 +37,8 @@ specify which components to return. } \examples{ +if (requireNamespace("tseries", quietly = TRUE)) { + library(tseries) data(EuStockMarkets) @@ -46,6 +48,9 @@ dax.garch tidy(dax.garch) glance(dax.garch) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[tseries:garch]{tseries::garch()}} diff --git a/man/tidy.geeglm.Rd b/man/tidy.geeglm.Rd index 8f42511e5..bc8581d57 100644 --- a/man/tidy.geeglm.Rd +++ b/man/tidy.geeglm.Rd @@ -51,6 +51,8 @@ missingness in the data beforehand. } \examples{ +if (requireNamespace("geepack", quietly = TRUE)) { + library(geepack) data(state) @@ -64,6 +66,9 @@ geefit <- geeglm(Income ~ Frost + Murder, tidy(geefit) tidy(geefit, conf.int = TRUE) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[geepack:geeglm]{geepack::geeglm()}} diff --git a/man/tidy.glht.Rd b/man/tidy.glht.Rd index 0552fa899..fbcbb70e4 100644 --- a/man/tidy.glht.Rd +++ b/man/tidy.glht.Rd @@ -37,6 +37,8 @@ specify which components to return. } \examples{ +if (requireNamespace("multcomp", quietly = TRUE)) { + library(multcomp) library(ggplot2) @@ -60,6 +62,9 @@ ggplot(mapping = aes(lhs, estimate)) + cld <- cld(wht) tidy(cld) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[multcomp:glht]{multcomp::glht()}} diff --git a/man/tidy.glmnet.Rd b/man/tidy.glmnet.Rd index 03ea8040a..65faffee2 100644 --- a/man/tidy.glmnet.Rd +++ b/man/tidy.glmnet.Rd @@ -44,6 +44,8 @@ choice of lambda. } \examples{ +if (requireNamespace("glmnet", quietly = TRUE)) { + library(glmnet) set.seed(2014) @@ -72,6 +74,9 @@ ggplot(tidied, aes(lambda, dev.ratio)) + g2 <- sample(1:2, 100, replace = TRUE) fit2 <- glmnet(x, g2, family = "binomial") tidy(fit2) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[glmnet:glmnet]{glmnet::glmnet()}} diff --git a/man/tidy.gmm.Rd b/man/tidy.gmm.Rd index d6a56b0bb..4eb50d7ad 100644 --- a/man/tidy.gmm.Rd +++ b/man/tidy.gmm.Rd @@ -42,6 +42,8 @@ specify which components to return. } \examples{ +if (requireNamespace("gmm", quietly = TRUE)) { + library(gmm) # examples come from the "gmm" package @@ -104,6 +106,9 @@ td2 \%>\% geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + geom_vline(xintercept = 0, color = "red", lty = 2) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[gmm:gmm]{gmm::gmm()}} diff --git a/man/tidy.ivreg.Rd b/man/tidy.ivreg.Rd index 7aa043c18..2b660e38d 100644 --- a/man/tidy.ivreg.Rd +++ b/man/tidy.ivreg.Rd @@ -47,6 +47,8 @@ objects of class \code{ivreg}, and will be supported in a later release. } \examples{ +if (requireNamespace("AER", quietly = TRUE)) { + library(AER) data("CigarettesSW", package = "AER") @@ -68,6 +70,9 @@ augment(ivr, data = CigarettesSW) augment(ivr, newdata = CigarettesSW) glance(ivr) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[AER:ivreg]{AER::ivreg()}} diff --git a/man/tidy.kappa.Rd b/man/tidy.kappa.Rd index 2e674f7b4..425090b5b 100644 --- a/man/tidy.kappa.Rd +++ b/man/tidy.kappa.Rd @@ -36,6 +36,8 @@ to \code{\link[psych:kappa]{psych::cohen.kappa()}} when creating the \code{kappa } \examples{ +if (requireNamespace("psych", quietly = TRUE)) { + library(psych) rater1 <- 1:9 @@ -49,6 +51,9 @@ library(ggplot2) ggplot(tidy(ck), aes(estimate, type)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[psych:kappa]{psych::cohen.kappa()}} diff --git a/man/tidy.kde.Rd b/man/tidy.kde.Rd index c0dd2cf76..ab036afac 100644 --- a/man/tidy.kde.Rd +++ b/man/tidy.kde.Rd @@ -36,6 +36,8 @@ on the output to return to a wide format. } \examples{ +if (requireNamespace("ks", quietly = TRUE)) { + library(ks) dat <- replicate(2, rnorm(100)) @@ -63,6 +65,9 @@ k3 <- kde(dat3) td3 <- tidy(k3) td3 + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[ks:kde]{ks::kde()}} diff --git a/man/tidy.lavaan.Rd b/man/tidy.lavaan.Rd index 3ff5a55c4..0b0a5ab1a 100644 --- a/man/tidy.lavaan.Rd +++ b/man/tidy.lavaan.Rd @@ -54,6 +54,9 @@ If a model has several distinct types of components, you will need to specify which components to return. } \examples{ + +if (requireNamespace("lavaan", quietly = TRUE)) { + \dontrun{ library(lavaan) @@ -64,6 +67,8 @@ cfa.fit <- cfa("F =~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9", tidy(cfa.fit) } +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[lavaan:cfa]{lavaan::cfa()}}, \code{\link[lavaan:sem]{lavaan::sem()}}, diff --git a/man/tidy.lm.beta.Rd b/man/tidy.lm.beta.Rd index 0d788728c..23567b412 100644 --- a/man/tidy.lm.beta.Rd +++ b/man/tidy.lm.beta.Rd @@ -43,6 +43,8 @@ the model with \code{na.action = na.exclude}. } \examples{ +if (requireNamespace("lm.beta", quietly = TRUE)) { + library(lm.beta) mod <- stats::lm(speed ~ ., data = cars) @@ -58,6 +60,9 @@ mod2 <- lm(weight ~ group) std2 <- lm.beta(mod2) tidy(std2, conf.int = TRUE) + +} + } \seealso{ Other lm tidiers: diff --git a/man/tidy.lmodel2.Rd b/man/tidy.lmodel2.Rd index 83f804a28..f109b265b 100644 --- a/man/tidy.lmodel2.Rd +++ b/man/tidy.lmodel2.Rd @@ -41,6 +41,8 @@ be valid. More information can be found in } \examples{ +if (requireNamespace("lmodel2", quietly = TRUE)) { + library(lmodel2) data(mod2ex2) @@ -56,6 +58,9 @@ ggplot(tidy(Ex2.res), aes(estimate, term, color = method)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[lmodel2:lmodel2]{lmodel2::lmodel2()}} diff --git a/man/tidy.lsmobj.Rd b/man/tidy.lsmobj.Rd index f6c45c250..019efa065 100644 --- a/man/tidy.lsmobj.Rd +++ b/man/tidy.lsmobj.Rd @@ -39,6 +39,8 @@ passed on to \code{\link[emmeans:summary.emmGrid]{emmeans::summary.emmGrid()}} o } \examples{ +if (requireNamespace("emmeans", quietly = TRUE)) { + library(emmeans) # linear model for sales of oranges per day oranges_lm1 <- lm(sales1 ~ price1 + price2 + day + store, data = oranges) @@ -79,6 +81,9 @@ ggplot(tidy(by_price, conf.int = TRUE), aes(price2, estimate, color = day)) + # joint_tests tidy(joint_tests(oranges_lm1)) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[emmeans:ref_grid]{emmeans::ref_grid()}}, \code{\link[emmeans:emmeans]{emmeans::emmeans()}}, diff --git a/man/tidy.map.Rd b/man/tidy.map.Rd index 665582a03..653bc5feb 100644 --- a/man/tidy.map.Rd +++ b/man/tidy.map.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("maps", quietly = TRUE)) { + library(maps) library(ggplot2) @@ -44,6 +46,9 @@ qplot(long, lat, data = tx, geom = "polygon", group = group, colour = I("white") ) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[maps:map]{maps::map()}} diff --git a/man/tidy.margins.Rd b/man/tidy.margins.Rd index fe0677e65..8131b1a52 100644 --- a/man/tidy.margins.Rd +++ b/man/tidy.margins.Rd @@ -44,6 +44,9 @@ Similarly, an \code{augment.margins()} method is not currently supported, but users can simply run the underlying model to obtain the same information. } \examples{ + +if (requireNamespace("margins", quietly = TRUE)) { + library(margins) ## Example 1: Logit model ## @@ -86,6 +89,9 @@ marg_ie2 <- margins(mod_ie, variables = "wt", ## Main var at = list(cyl = c(4,6,8), drat = c(3, 3.5, 4))) ## Modulating vars tidy(marg_ie2) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[margins:margins]{margins::margins()}} diff --git a/man/tidy.mediate.Rd b/man/tidy.mediate.Rd index d813d222e..bf683ae88 100644 --- a/man/tidy.mediate.Rd +++ b/man/tidy.mediate.Rd @@ -41,6 +41,9 @@ effect in the control and treatment groups, respectively. And the last two the direct effect in each group. } \examples{ + +if (requireNamespace("mediation", quietly = TRUE)) { + library(mediation) data(jobs) @@ -51,6 +54,9 @@ mod <- mediate(b, c, sims = 50, treat = "treat", mediator = "job_seek") tidy(mod) tidy(mod, conf.int = TRUE) tidy(mod, conf.int = TRUE, conf.level = .99) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[mediation:mediate]{mediation::mediate()}} diff --git a/man/tidy.mfx.Rd b/man/tidy.mfx.Rd index f2115a67d..b41fa43eb 100644 --- a/man/tidy.mfx.Rd +++ b/man/tidy.mfx.Rd @@ -67,6 +67,10 @@ in the data, or ii) the average of the sample marginal effects. See \code{vignette("mfxarticle")} from the \code{mfx} package for more details. } \examples{ + + +if (requireNamespace("mfx", quietly = TRUE)) { + \dontrun{ library(mfx) @@ -86,6 +90,9 @@ tidy(mod_probmfx, conf.int = TRUE) augment(mod_probmfx) glance(mod_probmfx) } + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[mfx:logitmfx]{mfx::logitmfx()}}, \code{\link[mfx:negbinmfx]{mfx::negbinmfx()}}, \code{\link[mfx:poissonmfx]{mfx::poissonmfx()}}, \code{\link[mfx:probitmfx]{mfx::probitmfx()}} diff --git a/man/tidy.mjoint.Rd b/man/tidy.mjoint.Rd index ae4ff1005..3752a3a5b 100644 --- a/man/tidy.mjoint.Rd +++ b/man/tidy.mjoint.Rd @@ -53,6 +53,9 @@ If a model has several distinct types of components, you will need to specify which components to return. } \examples{ + +if (requireNamespace("joineRML", quietly = TRUE)) { + \dontrun{ # Fit a joint model with bivariate longitudinal outcomes library(joineRML) @@ -95,6 +98,7 @@ hvd2 <- augment(fit) # Extract model statistics glance(fit) } +} } \seealso{ diff --git a/man/tidy.mle2.Rd b/man/tidy.mle2.Rd index 6cd821af9..14d36a398 100644 --- a/man/tidy.mle2.Rd +++ b/man/tidy.mle2.Rd @@ -38,6 +38,8 @@ specify which components to return. } \examples{ +if (requireNamespace("bbmle", quietly = TRUE)) { + library(bbmle) x <- 0:10 @@ -49,6 +51,9 @@ fit <- mle2(y ~ dpois(lambda = ymean), ) tidy(fit) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[bbmle:mle2]{bbmle::mle2()}}, \code{\link[=tidy_optim]{tidy_optim()}} diff --git a/man/tidy.mlogit.Rd b/man/tidy.mlogit.Rd index 64acf4de6..1362cf275 100644 --- a/man/tidy.mlogit.Rd +++ b/man/tidy.mlogit.Rd @@ -32,6 +32,9 @@ These methods tidy the coefficients of mnl and nl models generated by the functions of the \code{mlogit} package. } \examples{ + +if (requireNamespace("mlogit", quietly = TRUE)) { + \dontrun{ library(mlogit) data("Fishing", package = "mlogit") @@ -43,6 +46,8 @@ augment(m) glance(m) } +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[mlogit:mlogit]{mlogit::mlogit()}} diff --git a/man/tidy.muhaz.Rd b/man/tidy.muhaz.Rd index d17b423ab..26db00182 100644 --- a/man/tidy.muhaz.Rd +++ b/man/tidy.muhaz.Rd @@ -29,12 +29,20 @@ If a model has several distinct types of components, you will need to specify which components to return. } \examples{ + +if (requireNamespace("muhaz", quietly = TRUE)) { + if (requireNamespace("survival", quietly = TRUE)) { + library(muhaz) library(survival) x <- muhaz(ovarian$futime, ovarian$fustat) tidy(x) glance(x) + + } +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[muhaz:muhaz]{muhaz::muhaz()}} diff --git a/man/tidy.multinom.Rd b/man/tidy.multinom.Rd index 6bc68d203..1b80be03e 100644 --- a/man/tidy.multinom.Rd +++ b/man/tidy.multinom.Rd @@ -39,6 +39,8 @@ models generated by \code{multinom} of the \code{nnet} package. } \examples{ +if (requireNamespace("nnet", quietly = TRUE)) { + library(nnet) library(MASS) @@ -54,6 +56,9 @@ glance(bwt.mu) fit.gear <- multinom(gear ~ mpg + factor(am), data = mtcars) tidy(fit.gear) glance(fit.gear) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[nnet:multinom]{nnet::multinom()}} diff --git a/man/tidy.negbin.Rd b/man/tidy.negbin.Rd index af954b5f5..c0a898f22 100644 --- a/man/tidy.negbin.Rd +++ b/man/tidy.negbin.Rd @@ -40,6 +40,9 @@ If a model has several distinct types of components, you will need to specify which components to return. } \examples{ + +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) r <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine) @@ -47,6 +50,8 @@ r <- glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine) tidy(r) glance(r) +} + } \seealso{ \code{\link[MASS:glm.nb]{MASS::glm.nb()}} diff --git a/man/tidy.orcutt.Rd b/man/tidy.orcutt.Rd index 4545b07e3..57da00c30 100644 --- a/man/tidy.orcutt.Rd +++ b/man/tidy.orcutt.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("orcutt", quietly = TRUE)) { + library(orcutt) reg <- lm(mpg ~ wt + qsec + disp, mtcars) @@ -40,6 +42,9 @@ co tidy(co) glance(co) + +} + } \seealso{ \code{\link[orcutt:cochrane.orcutt]{orcutt::cochrane.orcutt()}} diff --git a/man/tidy.poLCA.Rd b/man/tidy.poLCA.Rd index c0179c5cd..b90b775be 100644 --- a/man/tidy.poLCA.Rd +++ b/man/tidy.poLCA.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("poLCA", quietly = TRUE)) { + library(poLCA) library(dplyr) @@ -75,6 +77,9 @@ count(au, .class) au2 <- augment(nes2a, data = election) au2 dim(au2) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[poLCA:poLCA]{poLCA::poLCA()}} diff --git a/man/tidy.polr.Rd b/man/tidy.polr.Rd index aa2187356..abf395046 100644 --- a/man/tidy.polr.Rd +++ b/man/tidy.polr.Rd @@ -65,6 +65,8 @@ p-values. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) fit <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) @@ -77,6 +79,8 @@ augment(fit, type.predict = "class") fit2 <- polr(factor(gear) ~ am + mpg + qsec, data = mtcars) tidy(fit, p.values = TRUE) +} + } \seealso{ \link{tidy}, \code{\link[MASS:polr]{MASS::polr()}} diff --git a/man/tidy.pyears.Rd b/man/tidy.pyears.Rd index c826583e8..b8646f942 100644 --- a/man/tidy.pyears.Rd +++ b/man/tidy.pyears.Rd @@ -37,6 +37,8 @@ this is simply the contents of \code{x$data}. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) temp.yr <- tcut(mgus$dxyr, 55:92, labels = as.character(55:91)) @@ -54,6 +56,9 @@ glance(pfit) pfit2 <- pyears(Surv(ptime / 365.25, pstat) ~ temp.yr + temp.age + sex, mgus) tidy(pfit2) glance(pfit2) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:pyears]{survival::pyears()}} diff --git a/man/tidy.rcorr.Rd b/man/tidy.rcorr.Rd index cea186db6..0ae51447b 100644 --- a/man/tidy.rcorr.Rd +++ b/man/tidy.rcorr.Rd @@ -42,6 +42,8 @@ output. } \examples{ +if (requireNamespace("Hmisc", quietly = TRUE)) { + library(Hmisc) mat <- replicate(52, rnorm(100)) @@ -62,6 +64,9 @@ ggplot(td, aes(p.value)) + ggplot(td, aes(estimate, p.value)) + geom_point() + scale_y_log10() + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[Hmisc:rcorr]{Hmisc::rcorr()}} diff --git a/man/tidy.ref.grid.Rd b/man/tidy.ref.grid.Rd index 906317f09..0d93d1e52 100644 --- a/man/tidy.ref.grid.Rd +++ b/man/tidy.ref.grid.Rd @@ -38,6 +38,8 @@ passed on to \code{\link[emmeans:summary.emmGrid]{emmeans::summary.emmGrid()}} o } \examples{ +if (requireNamespace("emmeans", quietly = TRUE)) { + library(emmeans) # linear model for sales of oranges per day oranges_lm1 <- lm(sales1 ~ price1 + price2 + day + store, data = oranges) @@ -78,6 +80,9 @@ ggplot(tidy(by_price, conf.int = TRUE), aes(price2, estimate, color = day)) + # joint_tests tidy(joint_tests(oranges_lm1)) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[emmeans:ref_grid]{emmeans::ref_grid()}}, \code{\link[emmeans:emmeans]{emmeans::emmeans()}}, diff --git a/man/tidy.regsubsets.Rd b/man/tidy.regsubsets.Rd index 38e33d435..358dee38b 100644 --- a/man/tidy.regsubsets.Rd +++ b/man/tidy.regsubsets.Rd @@ -30,8 +30,13 @@ specify which components to return. } \examples{ +if (requireNamespace("leaps", quietly = TRUE)) { + all_fits <- leaps::regsubsets(hp ~ ., mtcars) tidy(all_fits) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[leaps:regsubsets]{leaps::regsubsets()}} diff --git a/man/tidy.ridgelm.Rd b/man/tidy.ridgelm.Rd index e618de943..1fa161461 100644 --- a/man/tidy.ridgelm.Rd +++ b/man/tidy.ridgelm.Rd @@ -30,6 +30,9 @@ specify which components to return. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + + names(longley)[1] <- "y" fit1 <- MASS::lm.ridge(y ~ ., longley) tidy(fit1) @@ -51,6 +54,9 @@ ggplot(td2, aes(lambda, GCV)) + ggplot(td2, aes(lambda, GCV)) + geom_line() + geom_vline(xintercept = g2$lambdaGCV, col = "red", lty = 2) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[MASS:lm.ridge]{MASS::lm.ridge()}} diff --git a/man/tidy.roc.Rd b/man/tidy.roc.Rd index 60816a177..ec97b4b79 100644 --- a/man/tidy.roc.Rd +++ b/man/tidy.roc.Rd @@ -31,6 +31,8 @@ specify which components to return. } \examples{ +if (requireNamespace("AUC", quietly = TRUE)) { + library(AUC) data(churn) r <- roc(churn$predictions, churn$labels) @@ -59,6 +61,9 @@ rocs <- churn \%>\% ggplot(rocs, aes(fpr, tpr, color = algorithm)) + geom_line() + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[AUC:roc]{AUC::roc()}} diff --git a/man/tidy.sarlm.Rd b/man/tidy.sarlm.Rd index 1d371ce5a..f78e4cbb8 100644 --- a/man/tidy.sarlm.Rd +++ b/man/tidy.sarlm.Rd @@ -33,6 +33,9 @@ These methods tidy the coefficients of spatial autoregression models generated by functions in the \code{spatialreg} package. } \examples{ + +if (requireNamespace("spatialreg", quietly = TRUE)) { + \dontrun{ library(spatialreg) data(oldcol, package = "spdep") @@ -64,6 +67,8 @@ glance(crime_sac) augment(crime_sac) } +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[spatialreg:ML_models]{spatialreg::lagsarlm()}}, \code{\link[spatialreg:ML_models]{spatialreg::errorsarlm()}}, diff --git a/man/tidy.speedglm.Rd b/man/tidy.speedglm.Rd index 11ed7f04d..0beed1cb2 100644 --- a/man/tidy.speedglm.Rd +++ b/man/tidy.speedglm.Rd @@ -42,6 +42,8 @@ specify which components to return. } \examples{ +if (requireNamespace("speedglm", quietly = TRUE)) { + library(speedglm) clotting <- data.frame( @@ -53,6 +55,9 @@ fit <- speedglm(lot1 ~ log(u), data = clotting, family = Gamma(log)) tidy(fit) glance(fit) + +} + } \seealso{ \code{\link[speedglm:speedglm]{speedglm::speedglm()}} diff --git a/man/tidy.speedlm.Rd b/man/tidy.speedlm.Rd index 6d5014d62..4b5c2b368 100644 --- a/man/tidy.speedlm.Rd +++ b/man/tidy.speedlm.Rd @@ -37,11 +37,16 @@ specify which components to return. } \examples{ +if (requireNamespace("speedglm", quietly = TRUE)) { + mod <- speedglm::speedlm(mpg ~ wt + qsec, data = mtcars, fitted = TRUE) tidy(mod) glance(mod) augment(mod) + +} + } \seealso{ \code{\link[speedglm:speedlm]{speedglm::speedlm()}}, \code{\link[=tidy.lm]{tidy.lm()}} diff --git a/man/tidy.summary.glht.Rd b/man/tidy.summary.glht.Rd index 9f750b1f2..024351fcb 100644 --- a/man/tidy.summary.glht.Rd +++ b/man/tidy.summary.glht.Rd @@ -31,6 +31,8 @@ specify which components to return. } \examples{ +if (requireNamespace("multcomp", quietly = TRUE)) { + library(multcomp) library(ggplot2) @@ -54,6 +56,9 @@ ggplot(mapping = aes(lhs, estimate)) + cld <- cld(wht) tidy(cld) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[multcomp:methods]{multcomp::summary.glht()}}, \code{\link[multcomp:glht]{multcomp::glht()}} diff --git a/man/tidy.summary_emm.Rd b/man/tidy.summary_emm.Rd index 4eaa14606..4d72b44a7 100644 --- a/man/tidy.summary_emm.Rd +++ b/man/tidy.summary_emm.Rd @@ -33,6 +33,8 @@ passed on to \code{\link[emmeans:summary.emmGrid]{emmeans::summary.emmGrid()}} o } \examples{ +if (requireNamespace("emmeans", quietly = TRUE)) { + library(emmeans) # linear model for sales of oranges per day oranges_lm1 <- lm(sales1 ~ price1 + price2 + day + store, data = oranges) @@ -73,6 +75,9 @@ ggplot(tidy(by_price, conf.int = TRUE), aes(price2, estimate, color = day)) + # joint_tests tidy(joint_tests(oranges_lm1)) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[emmeans:ref_grid]{emmeans::ref_grid()}}, \code{\link[emmeans:emmeans]{emmeans::emmeans()}}, diff --git a/man/tidy.survdiff.Rd b/man/tidy.survdiff.Rd index c8fc264d1..10cb65a5a 100644 --- a/man/tidy.survdiff.Rd +++ b/man/tidy.survdiff.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) s <- survdiff( @@ -39,6 +41,9 @@ s <- survdiff( tidy(s) glance(s) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:survdiff]{survival::survdiff()}} diff --git a/man/tidy.survexp.Rd b/man/tidy.survexp.Rd index 9cc4a7c49..50be433a7 100644 --- a/man/tidy.survexp.Rd +++ b/man/tidy.survexp.Rd @@ -31,6 +31,8 @@ specify which components to return. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) sexpfit <- survexp( futime ~ 1, @@ -45,6 +47,9 @@ sexpfit <- survexp( tidy(sexpfit) glance(sexpfit) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:survexp]{survival::survexp()}} diff --git a/man/tidy.survfit.Rd b/man/tidy.survfit.Rd index d95a4688b..db88f674d 100644 --- a/man/tidy.survfit.Rd +++ b/man/tidy.survfit.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) cfit <- coxph(Surv(time, status) ~ age + sex, lung) sfit <- survfit(cfit) @@ -52,6 +54,9 @@ td_multi ggplot(td_multi, aes(time, estimate, group = state)) + geom_line(aes(color = state)) + geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:survfit]{survival::survfit()}} diff --git a/man/tidy.survreg.Rd b/man/tidy.survreg.Rd index caebef934..fb4aa0f30 100644 --- a/man/tidy.survreg.Rd +++ b/man/tidy.survreg.Rd @@ -37,6 +37,8 @@ specify which components to return. } \examples{ +if (requireNamespace("survival", quietly = TRUE)) { + library(survival) sr <- survreg( @@ -56,6 +58,9 @@ ggplot(td, aes(estimate, term)) + geom_point() + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) + geom_vline(xintercept = 0) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[survival:survreg]{survival::survreg()}} diff --git a/man/tidy.svyolr.Rd b/man/tidy.svyolr.Rd index 900ff2254..f5a311feb 100644 --- a/man/tidy.svyolr.Rd +++ b/man/tidy.svyolr.Rd @@ -65,12 +65,17 @@ p-values. } \examples{ +if (requireNamespace("MASS", quietly = TRUE)) { + library(MASS) fit <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) tidy(fit, exponentiate = TRUE, conf.int = TRUE) glance(fit) + +} + } \seealso{ \link{tidy}, \code{\link[survey:svyolr]{survey::svyolr()}} diff --git a/man/tidy.systemfit.Rd b/man/tidy.systemfit.Rd index a66197b34..387678c5f 100644 --- a/man/tidy.systemfit.Rd +++ b/man/tidy.systemfit.Rd @@ -41,6 +41,8 @@ Default returns a tibble of six columns. } \examples{ +if (requireNamespace("systemfit", quietly = TRUE)) { + set.seed(27) library(systemfit) @@ -56,6 +58,9 @@ fit <- systemfit(formula = list(Y ~ Z, W ~ X), data = df, method = "SUR") tidy(fit) tidy(fit, conf.int = TRUE) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[systemfit:systemfit]{systemfit::systemfit()}} diff --git a/man/tidy.varest.Rd b/man/tidy.varest.Rd index a6f17e1b0..2aa97fab1 100644 --- a/man/tidy.varest.Rd +++ b/man/tidy.varest.Rd @@ -47,6 +47,9 @@ confidence intervals for \code{varest} objects. Setting the \code{tidy} argument \code{conf.int = TRUE} will return a warning. } \examples{ + +if (requireNamespace("vars", quietly = TRUE)) { + library(vars) data("Canada", package = "vars") @@ -54,6 +57,9 @@ mod <- VAR(Canada, p = 1, type = "both") tidy(mod) glance(mod) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[vars:VAR]{vars::VAR()}} diff --git a/man/tidy.zoo.Rd b/man/tidy.zoo.Rd index 51823c821..06b0b51bd 100644 --- a/man/tidy.zoo.Rd +++ b/man/tidy.zoo.Rd @@ -30,6 +30,8 @@ specify which components to return. } \examples{ +if (requireNamespace("zoo", quietly = TRUE)) { + library(zoo) library(ggplot2) @@ -53,6 +55,9 @@ ggplot(tidy(Z), aes(index, value)) + Zrolled <- rollmean(Z, 5) ggplot(tidy(Zrolled), aes(index, value, color = series)) + geom_line() + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[zoo:zoo]{zoo::zoo()}} diff --git a/man/tidy_gam_hastie.Rd b/man/tidy_gam_hastie.Rd index 99c266353..bc3649c28 100644 --- a/man/tidy_gam_hastie.Rd +++ b/man/tidy_gam_hastie.Rd @@ -34,11 +34,16 @@ Tidy \code{gam} objects created by calls to \code{\link[mgcv:gam]{mgcv::gam()}} } \examples{ +if (requireNamespace("gam", quietly = TRUE)) { + library(gam) g <- gam(mpg ~ s(hp, 4) + am + qsec, data = mtcars) tidy(g) glance(g) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[gam:gam]{gam::gam()}}, \code{\link[=tidy.anova]{tidy.anova()}}, \code{\link[=tidy.gam]{tidy.gam()}} diff --git a/man/tidy_irlba.Rd b/man/tidy_irlba.Rd index 0b3b297b0..e90c136da 100644 --- a/man/tidy_irlba.Rd +++ b/man/tidy_irlba.Rd @@ -74,6 +74,8 @@ A very thin wrapper around \code{\link[=tidy_svd]{tidy_svd()}}. } \examples{ +if (requireNamespace("modeldata", quietly = TRUE)) { + library(modeldata) data(hpc_data) @@ -101,6 +103,9 @@ tidy_u \%>\% ggplot(aes(class, value)) + geom_boxplot() + facet_wrap(~PC, scale = "free_y") + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[irlba:irlba]{irlba::irlba()}} diff --git a/man/tidy_svd.Rd b/man/tidy_svd.Rd index d00f74c9b..8fce53b6b 100644 --- a/man/tidy_svd.Rd +++ b/man/tidy_svd.Rd @@ -87,6 +87,8 @@ that SVD is only equivalent to PCA on centered data. } \examples{ +if (requireNamespace("modeldata", quietly = TRUE)) { + library(modeldata) data(hpc_data) @@ -114,6 +116,9 @@ tidy_u \%>\% ggplot(aes(class, value)) + geom_boxplot() + facet_wrap(~PC, scale = "free_y") + +} + } \seealso{ \code{\link[base:svd]{base::svd()}} From aa7d45d4e8d42fd73fc40eeaca15f7c317769078 Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Tue, 19 Oct 2021 20:05:58 -0400 Subject: [PATCH 08/11] use Suggested packages conditionally last few things flagged with `devtools::check(env_vars = c(_R_CHECK_DEPENDS_ONLY_ = "true"))` --- R/plm-tidiers.R | 5 +++++ man/augment.plm.Rd | 5 +++++ man/glance.plm.Rd | 5 +++++ man/tidy.plm.Rd | 5 +++++ tests/testthat/test-car.R | 2 ++ tests/testthat/test-emmeans.R | 5 ++++- tests/testthat/test-polca.R | 1 + tests/testthat/test-stats-nls.R | 2 ++ 8 files changed, 29 insertions(+), 1 deletion(-) diff --git a/R/plm-tidiers.R b/R/plm-tidiers.R index e37969df4..7e0dd7537 100644 --- a/R/plm-tidiers.R +++ b/R/plm-tidiers.R @@ -9,6 +9,8 @@ #' #' @examples #' +#' if (requireNamespace("plm", quietly = TRUE)) { +#' #' library(plm) #' #' data("Produc", package = "plm") @@ -24,6 +26,9 @@ #' #' augment(zz) #' glance(zz) +#' +#' } +#' #' @aliases plm_tidiers #' @export #' @seealso [tidy()], [plm::plm()], [tidy.lm()] diff --git a/man/augment.plm.Rd b/man/augment.plm.Rd index 0fc337224..90cf7f76e 100644 --- a/man/augment.plm.Rd +++ b/man/augment.plm.Rd @@ -70,6 +70,8 @@ missing at this time. } \examples{ +if (requireNamespace("plm", quietly = TRUE)) { + library(plm) data("Produc", package = "plm") @@ -85,6 +87,9 @@ tidy(zz, conf.int = TRUE, conf.level = 0.9) augment(zz) glance(zz) + +} + } \seealso{ \code{\link[=augment]{augment()}}, \code{\link[plm:plm]{plm::plm()}} diff --git a/man/glance.plm.Rd b/man/glance.plm.Rd index efe06312e..bc73a41c1 100644 --- a/man/glance.plm.Rd +++ b/man/glance.plm.Rd @@ -41,6 +41,8 @@ of the appropriate type. } \examples{ +if (requireNamespace("plm", quietly = TRUE)) { + library(plm) data("Produc", package = "plm") @@ -56,6 +58,9 @@ tidy(zz, conf.int = TRUE, conf.level = 0.9) augment(zz) glance(zz) + +} + } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[plm:plm]{plm::plm()}} diff --git a/man/tidy.plm.Rd b/man/tidy.plm.Rd index 96403adb0..937789d8d 100644 --- a/man/tidy.plm.Rd +++ b/man/tidy.plm.Rd @@ -37,6 +37,8 @@ specify which components to return. } \examples{ +if (requireNamespace("plm", quietly = TRUE)) { + library(plm) data("Produc", package = "plm") @@ -52,6 +54,9 @@ tidy(zz, conf.int = TRUE, conf.level = 0.9) augment(zz) glance(zz) + +} + } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[plm:plm]{plm::plm()}}, \code{\link[=tidy.lm]{tidy.lm()}} diff --git a/tests/testthat/test-car.R b/tests/testthat/test-car.R index ca6e66442..adccd9588 100644 --- a/tests/testthat/test-car.R +++ b/tests/testthat/test-car.R @@ -4,6 +4,8 @@ skip_on_cran() skip_if_not_installed("modeltests") library(modeltests) + +skip_if_not_installed("survival") library(survival) skip_if_not_installed("car") diff --git a/tests/testthat/test-emmeans.R b/tests/testthat/test-emmeans.R index e53a866ed..bac414fd1 100644 --- a/tests/testthat/test-emmeans.R +++ b/tests/testthat/test-emmeans.R @@ -8,6 +8,9 @@ library(modeltests) skip_if_not_installed("lsmeans") library(lsmeans) +skip_if_not_installed("lme4") +library(lme4) + fit <- lm(sales1 ~ price1 + price2 + day + store, data = oranges) rg <- ref.grid(fit) @@ -72,7 +75,7 @@ test_that("summary_emm tidiers work", { check_tidy_output(tdjt) check_dims(tdjt, 4, 5) - library("lme4") + glmm <- glmer( cbind(incidence, size - incidence) ~ period + (1 | herd), data = cbpp, family = binomial diff --git a/tests/testthat/test-polca.R b/tests/testthat/test-polca.R index 30abefbfe..511c4679c 100644 --- a/tests/testthat/test-polca.R +++ b/tests/testthat/test-polca.R @@ -6,6 +6,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("poLCA") +skip_if_not_installed("MASS") library(poLCA) data(values) diff --git a/tests/testthat/test-stats-nls.R b/tests/testthat/test-stats-nls.R index 11b6da253..7bbe12f12 100644 --- a/tests/testthat/test-stats-nls.R +++ b/tests/testthat/test-stats-nls.R @@ -5,6 +5,8 @@ skip_on_cran() skip_if_not_installed("modeltests") library(modeltests) +skip_if_not_installed("MASS") + fit <- nls( wt ~ a + b * mpg + c / disp, data = mtcars, From 3e1efad4167440f8c85994628bb53ed19829e39d Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Wed, 20 Oct 2021 08:07:44 -0400 Subject: [PATCH 09/11] skip `augment.sarlm` examples runtime was 10.16s > 10s on a CRAN test--drop the `Suggests` logic in hopes that these will actually not be run --- R/spdep-tidiers.R | 4 ---- man/augment.sarlm.Rd | 4 ---- man/glance.sarlm.Rd | 4 ---- man/tidy.sarlm.Rd | 4 ---- 4 files changed, 16 deletions(-) diff --git a/R/spdep-tidiers.R b/R/spdep-tidiers.R index 919812ab7..55f29cac5 100644 --- a/R/spdep-tidiers.R +++ b/R/spdep-tidiers.R @@ -12,8 +12,6 @@ #' #' @examples #' -#' if (requireNamespace("spatialreg", quietly = TRUE)) { -#' #' \dontrun{ #' library(spatialreg) #' data(oldcol, package = "spdep") @@ -45,8 +43,6 @@ #' augment(crime_sac) #' } #' -#' } -#' #' @aliases spatialreg_tidiers #' @export #' @family spatialreg tidiers diff --git a/man/augment.sarlm.Rd b/man/augment.sarlm.Rd index e97810cd3..e071a7be8 100644 --- a/man/augment.sarlm.Rd +++ b/man/augment.sarlm.Rd @@ -72,8 +72,6 @@ currently does not take in \code{data} or \code{newdata} arguments. } \examples{ -if (requireNamespace("spatialreg", quietly = TRUE)) { - \dontrun{ library(spatialreg) data(oldcol, package = "spdep") @@ -105,8 +103,6 @@ glance(crime_sac) augment(crime_sac) } -} - } \seealso{ \code{\link[=augment]{augment()}} diff --git a/man/glance.sarlm.Rd b/man/glance.sarlm.Rd index a39d358e0..4a29f3bfb 100644 --- a/man/glance.sarlm.Rd +++ b/man/glance.sarlm.Rd @@ -42,8 +42,6 @@ of the appropriate type. } \examples{ -if (requireNamespace("spatialreg", quietly = TRUE)) { - \dontrun{ library(spatialreg) data(oldcol, package = "spdep") @@ -75,8 +73,6 @@ glance(crime_sac) augment(crime_sac) } -} - } \seealso{ \code{\link[=glance]{glance()}}, \code{\link[spatialreg:ML_models]{spatialreg::lagsarlm()}}, \code{\link[spatialreg:ML_models]{spatialreg::errorsarlm()}}, diff --git a/man/tidy.sarlm.Rd b/man/tidy.sarlm.Rd index f78e4cbb8..f7871934b 100644 --- a/man/tidy.sarlm.Rd +++ b/man/tidy.sarlm.Rd @@ -34,8 +34,6 @@ models generated by functions in the \code{spatialreg} package. } \examples{ -if (requireNamespace("spatialreg", quietly = TRUE)) { - \dontrun{ library(spatialreg) data(oldcol, package = "spdep") @@ -67,8 +65,6 @@ glance(crime_sac) augment(crime_sac) } -} - } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[spatialreg:ML_models]{spatialreg::lagsarlm()}}, \code{\link[spatialreg:ML_models]{spatialreg::errorsarlm()}}, From 3e4dce0e82b04ecfe25a38f510133d60b0d79563 Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Sun, 31 Oct 2021 16:03:23 -0400 Subject: [PATCH 10/11] bump ggplot2 to Imports --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 132ee22c0..a9297317e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -539,7 +539,8 @@ Imports: rlang, stringr, tibble (>= 3.0.0), - tidyr (>= 1.0.0) + tidyr (>= 1.0.0), + ggplot2 Suggests: AER, akima, @@ -565,7 +566,6 @@ Suggests: gam (>= 1.15), gee, geepack, - ggplot2, glmnet, glmnetUtils, gmm, From 5cad50f1e83fd7b01da8a9ebec1d2ab021fc9aef Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Sun, 31 Oct 2021 16:51:33 -0400 Subject: [PATCH 11/11] conditional use of suggested packages more things flagged by `devtools::check(env_vars = c(_R_CHECK_DEPENDS_ONLY_ = "true"))` after bumping ggplot2 to Imports--realized that this check only shows the first error, so need to sequentially rerun checks until it comes back clear. --- R/car-tidiers.R | 4 ++++ R/survey-tidiers.R | 6 +++++- man/glance.svyglm.Rd | 4 ++++ man/leveneTest_tidiers.Rd | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/R/car-tidiers.R b/R/car-tidiers.R index f40114102..46a7265f4 100644 --- a/R/car-tidiers.R +++ b/R/car-tidiers.R @@ -55,11 +55,15 @@ glance.durbinWatsonTest <- function(x, ...) tidy(x) #' #' @examples #' +#' if (requireNamespace("car", quietly = TRUE)) { +#' #' library(car) #' data(Moore) #' lt <- with(Moore, leveneTest(conformity, fcategory)) #' tidy(lt) #' glance(lt) # same output for all leveneTest +#' +#' } #' @name leveneTest_tidiers #' @family car tidiers #' @export diff --git a/R/survey-tidiers.R b/R/survey-tidiers.R index 43ee80573..a114dd52a 100644 --- a/R/survey-tidiers.R +++ b/R/survey-tidiers.R @@ -104,7 +104,8 @@ tidy.svyglm <- function(x, conf.int = FALSE, conf.level = 0.95, #' ) #' #' @examples -#' +#' if (requireNamespace("survey", quietly = TRUE)) { +#' #' library(survey) #' #' set.seed(123) @@ -128,6 +129,9 @@ tidy.svyglm <- function(x, conf.int = FALSE, conf.level = 0.95, #' ) #' #' glance(m) +#' +#' } +#' #' @references Lumley T, Scott A (2015). AIC and BIC for modelling with complex #' survey data. *Journal of Survey Statistics and Methodology*, 3(1). #' diff --git a/man/glance.svyglm.Rd b/man/glance.svyglm.Rd index dee077105..12b6d97ca 100644 --- a/man/glance.svyglm.Rd +++ b/man/glance.svyglm.Rd @@ -45,6 +45,7 @@ that no longer have a well-defined value are filled in with an \code{NA} of the appropriate type. } \examples{ +if (requireNamespace("survey", quietly = TRUE)) { library(survey) @@ -69,6 +70,9 @@ m <- survey::svyglm( ) glance(m) + +} + } \references{ Lumley T, Scott A (2015). AIC and BIC for modelling with complex diff --git a/man/leveneTest_tidiers.Rd b/man/leveneTest_tidiers.Rd index 1021c70a4..bfe96bd85 100644 --- a/man/leveneTest_tidiers.Rd +++ b/man/leveneTest_tidiers.Rd @@ -28,11 +28,15 @@ of those methods. } \examples{ +if (requireNamespace("car", quietly = TRUE)) { + library(car) data(Moore) lt <- with(Moore, leveneTest(conformity, fcategory)) tidy(lt) glance(lt) # same output for all leveneTest + +} } \seealso{ \code{\link[=tidy]{tidy()}}, \code{\link[=glance]{glance()}}, \code{\link[car:leveneTest]{car::leveneTest()}}