diff --git a/DESCRIPTION b/DESCRIPTION index 3b813c38..7cfea7f5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -44,7 +44,6 @@ Imports: future, methods, mvtnorm, - rlang, stats, survival, utils diff --git a/NAMESPACE b/NAMESPACE index 6555d7ec..e7d91907 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -42,7 +42,6 @@ importFrom(future,plan) importFrom(methods,is) importFrom(mvtnorm,GenzBretz) importFrom(mvtnorm,pmvnorm) -importFrom(rlang,is_installed) importFrom(survival,Surv) importFrom(survival,is.Surv) importFrom(survival,survfit) diff --git a/R/get_analysis_date.R b/R/get_analysis_date.R index 07a3a0cd..e3cab3f9 100644 --- a/R/get_analysis_date.R +++ b/R/get_analysis_date.R @@ -69,7 +69,7 @@ #' #' @export #' -#' @examplesIf rlang::is_installed("gsDesign2") +#' @examplesIf requireNamespace("gsDesign2", quietly = TRUE) #' library(gsDesign2) #' #' alpha <- 0.025 diff --git a/R/get_cut_date_by_event.R b/R/get_cut_date_by_event.R index b537c19b..4182e1d3 100644 --- a/R/get_cut_date_by_event.R +++ b/R/get_cut_date_by_event.R @@ -29,7 +29,7 @@ #' #' @export #' -#' @examplesIf rlang::is_installed("dplyr") +#' @examplesIf requireNamespace("dplyr", quietly = TRUE) #' library(dplyr) #' #' # Use default enrollment and calendar cut date diff --git a/R/randomize_by_fixed_block.R b/R/randomize_by_fixed_block.R index 0af27f95..86aacee1 100644 --- a/R/randomize_by_fixed_block.R +++ b/R/randomize_by_fixed_block.R @@ -32,7 +32,7 @@ #' #' @export #' -#' @examplesIf rlang::is_installed("dplyr") +#' @examplesIf requireNamespace("dplyr", quietly = TRUE) #' library(dplyr) #' #' # Example 1 diff --git a/R/sim_fixed_n.R b/R/sim_fixed_n.R index c52d1090..1d2b34d9 100644 --- a/R/sim_fixed_n.R +++ b/R/sim_fixed_n.R @@ -73,7 +73,7 @@ #' #' @export #' -#' @examplesIf rlang::is_installed("dplyr") +#' @examplesIf requireNamespace("dplyr", quietly = TRUE) #' library(dplyr) #' library(future) #' diff --git a/R/sim_gs_n.R b/R/sim_gs_n.R index 60eda972..1aff59cb 100644 --- a/R/sim_gs_n.R +++ b/R/sim_gs_n.R @@ -42,7 +42,7 @@ #' #' @export #' -#' @examplesIf rlang::is_installed("gsDesign2") +#' @examplesIf requireNamespace("gsDesign2", quietly = TRUE) #' library(gsDesign2) #' #' # Parameters for enrollment diff --git a/R/sim_pw_surv.R b/R/sim_pw_surv.R index 485dfe2e..d0e1730c 100644 --- a/R/sim_pw_surv.R +++ b/R/sim_pw_surv.R @@ -60,7 +60,7 @@ #' #' @export #' -#' @examplesIf rlang::is_installed("dplyr") +#' @examplesIf requireNamespace("dplyr", quietly = TRUE) #' library(dplyr) #' #' # Example 1 diff --git a/R/simtrial-package.R b/R/simtrial-package.R index 8327f1b9..6c225d57 100644 --- a/R/simtrial-package.R +++ b/R/simtrial-package.R @@ -24,7 +24,3 @@ NULL #' @importFrom Rcpp sourceCpp NULL - -# For safeguarding code examples and tests -#' @importFrom rlang is_installed -NULL diff --git a/R/wlr_weight.R b/R/wlr_weight.R index 106a73fe..5d4223ec 100644 --- a/R/wlr_weight.R +++ b/R/wlr_weight.R @@ -93,7 +93,7 @@ mb <- function(delay = 4, w_max = Inf) { #' "Designing therapeutic cancer vaccine trials with delayed treatment effect." #' @export #' -#' @examplesIf rlang::is_installed("gsDesign2") +#' @examplesIf requireNamespace("gsDesign2", quietly = TRUE) #' library(gsDesign2) #' #' # Example 1: Unstratified ---- diff --git a/man/early_zero.Rd b/man/early_zero.Rd index f77ddfd3..44b47fa1 100644 --- a/man/early_zero.Rd +++ b/man/early_zero.Rd @@ -19,7 +19,7 @@ A list of parameters of the zero early weighting function Zero early weighting function } \examples{ -\dontshow{if (rlang::is_installed("gsDesign2")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("gsDesign2", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(gsDesign2) # Example 1: Unstratified ---- diff --git a/man/get_analysis_date.Rd b/man/get_analysis_date.Rd index 0732e9b9..7e4ac335 100644 --- a/man/get_analysis_date.Rd +++ b/man/get_analysis_date.Rd @@ -79,7 +79,7 @@ dates determined solely by Condition 1, Condition 2, Condition 3, Condition 4 and Condition 5, respectively. } \examples{ -\dontshow{if (rlang::is_installed("gsDesign2")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("gsDesign2", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(gsDesign2) alpha <- 0.025 diff --git a/man/get_cut_date_by_event.Rd b/man/get_cut_date_by_event.Rd index 51615aa0..70145a85 100644 --- a/man/get_cut_date_by_event.Rd +++ b/man/get_cut_date_by_event.Rd @@ -20,7 +20,7 @@ is never reached, the final \code{cte} at which an event occurs. Get date at which an event count is reached } \examples{ -\dontshow{if (rlang::is_installed("dplyr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("dplyr", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(dplyr) # Use default enrollment and calendar cut date diff --git a/man/randomize_by_fixed_block.Rd b/man/randomize_by_fixed_block.Rd index abea25e4..4e2a2684 100644 --- a/man/randomize_by_fixed_block.Rd +++ b/man/randomize_by_fixed_block.Rd @@ -23,7 +23,7 @@ The final block will be a partial block if \code{n} is not an exact multiple of the block length. } \examples{ -\dontshow{if (rlang::is_installed("dplyr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("dplyr", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(dplyr) # Example 1 diff --git a/man/sim_fixed_n.Rd b/man/sim_fixed_n.Rd index 90d7ded7..96db5bec 100644 --- a/man/sim_fixed_n.Rd +++ b/man/sim_fixed_n.Rd @@ -82,7 +82,7 @@ for data cutoff: } } \examples{ -\dontshow{if (rlang::is_installed("dplyr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("dplyr", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(dplyr) library(future) diff --git a/man/sim_gs_n.Rd b/man/sim_gs_n.Rd index 654f170b..103a39ad 100644 --- a/man/sim_gs_n.Rd +++ b/man/sim_gs_n.Rd @@ -63,7 +63,7 @@ WARNING: This experimental function is a work-in-progress. The function arguments will change as we add additional features. } \examples{ -\dontshow{if (rlang::is_installed("gsDesign2")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("gsDesign2", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(gsDesign2) # Parameters for enrollment diff --git a/man/sim_pw_surv.Rd b/man/sim_pw_surv.Rd index b809b1f0..b1563e1c 100644 --- a/man/sim_pw_surv.Rd +++ b/man/sim_pw_surv.Rd @@ -65,7 +65,7 @@ Default arguments are set up to allow very simple implementation of a non-proportional hazards assumption for an unstratified design. } \examples{ -\dontshow{if (rlang::is_installed("dplyr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("dplyr", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(dplyr) # Example 1 diff --git a/vignettes/arbitrary-hazard.Rmd b/vignettes/arbitrary-hazard.Rmd index 5ee1b1a8..8bd76977 100644 --- a/vignettes/arbitrary-hazard.Rmd +++ b/vignettes/arbitrary-hazard.Rmd @@ -16,7 +16,8 @@ knitr::opts_chunk$set( out.width = "100%" ) -run <- if (rlang::is_installed(c("dplyr", "ggplot2"))) TRUE else FALSE +run <- requireNamespace("dplyr", quietly = TRUE) && + requireNamespace("ggplot2", quietly = TRUE) knitr::opts_chunk$set(eval = run) ``` diff --git a/vignettes/maxcombo.Rmd b/vignettes/maxcombo.Rmd index ce133d14..626dbf8f 100644 --- a/vignettes/maxcombo.Rmd +++ b/vignettes/maxcombo.Rmd @@ -14,7 +14,8 @@ knitr::opts_chunk$set( comment = "#>" ) -run <- if (rlang::is_installed(c("dplyr", "gt"))) TRUE else FALSE +run <- requireNamespace("dplyr", quietly = TRUE) && + requireNamespace("gt", quietly = TRUE) knitr::opts_chunk$set(eval = run) ``` diff --git a/vignettes/modest-wlrt.Rmd b/vignettes/modest-wlrt.Rmd index eecc0867..66e7abdc 100644 --- a/vignettes/modest-wlrt.Rmd +++ b/vignettes/modest-wlrt.Rmd @@ -14,7 +14,7 @@ knitr::opts_chunk$set( comment = "#>" ) -run <- if (rlang::is_installed(c("dplyr"))) TRUE else FALSE +run <- requireNamespace("dplyr", quietly = TRUE) knitr::opts_chunk$set(eval = run) ``` diff --git a/vignettes/rmst.Rmd b/vignettes/rmst.Rmd index 9880dd79..4ecf99aa 100644 --- a/vignettes/rmst.Rmd +++ b/vignettes/rmst.Rmd @@ -14,7 +14,8 @@ knitr::opts_chunk$set( comment = "#>" ) -run <- if (rlang::is_installed(c("gt", "survRM2"))) TRUE else FALSE +run <- requireNamespace("gt", quietly = TRUE) && + requireNamespace("survRM2", quietly = TRUE) knitr::opts_chunk$set(eval = run) ``` diff --git a/vignettes/routines.Rmd b/vignettes/routines.Rmd index 60556758..07951bfb 100644 --- a/vignettes/routines.Rmd +++ b/vignettes/routines.Rmd @@ -14,7 +14,8 @@ knitr::opts_chunk$set( comment = "#>" ) -run <- if (rlang::is_installed(c("dplyr", "gt"))) TRUE else FALSE +run <- requireNamespace("dplyr", quietly = TRUE) && + requireNamespace("gt", quietly = TRUE) knitr::opts_chunk$set(eval = run) ```