diff --git a/R/aaa_models.R b/R/aaa_models.R index c27d21379..6cc08f40e 100644 --- a/R/aaa_models.R +++ b/R/aaa_models.R @@ -54,7 +54,7 @@ model_info_table <- #' @keywords internal #' @references "How to build a parsnip model" #' \url{https://www.tidymodels.org/learn/develop/models/} -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' # Access the model data: #' current_code <- get_model_env() #' ls(envir = current_code) @@ -552,7 +552,7 @@ check_interface_val <- function(x) { #' #' @references "How to build a parsnip model" #' \url{https://www.tidymodels.org/learn/develop/models/} -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' # set_new_model("shallow_learning_model") #' #' # Show the information about a model: diff --git a/R/aaa_multi_predict.R b/R/aaa_multi_predict.R index 9970c51d3..580bb0052 100644 --- a/R/aaa_multi_predict.R +++ b/R/aaa_multi_predict.R @@ -53,7 +53,7 @@ predict.model_spec <- function(object, ...) { #' `multi_predict_args()` returns a character vector of argument names (or `NA` #' if none exist). #' @keywords internal -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' lm_model_idea <- linear_reg() %>% set_engine("lm") #' has_multi_predict(lm_model_idea) #' lm_model_fit <- fit(lm_model_idea, mpg ~ ., data = mtcars) diff --git a/R/adds.R b/R/adds.R index 613241d7d..a210958fa 100644 --- a/R/adds.R +++ b/R/adds.R @@ -2,7 +2,7 @@ #' #' @param x A data frame #' @return The same data frame with a column of 1-based integers named `.row`. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' mtcars %>% add_rowindex() #' @export add_rowindex <- function(x) { diff --git a/R/arguments.R b/R/arguments.R index ed0369efd..2ed1de0af 100644 --- a/R/arguments.R +++ b/R/arguments.R @@ -40,7 +40,7 @@ check_eng_args <- function(args, obj, core_args) { #' @return An updated model object. #' @details `set_args()` will replace existing values of the arguments. #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' rand_forest() #' #' rand_forest() %>% @@ -294,7 +294,7 @@ make_xy_call <- function(object, target, env) { #' @param offset A number subtracted off of the number of rows available in the #' data. #' @return An integer (and perhaps a warning). -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' nearest_neighbor(neighbors= 100) %>% #' set_engine("kknn") %>% diff --git a/R/augment.R b/R/augment.R index 723a1d6a6..6e55055a6 100644 --- a/R/augment.R +++ b/R/augment.R @@ -37,7 +37,7 @@ #' @references #' \url{https://www.tidymodels.org/learn/statistics/survival-metrics/} #' @export -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' car_trn <- mtcars[11:32,] #' car_tst <- mtcars[ 1:10,] #' diff --git a/R/bart.R b/R/bart.R index ed8f08e9b..63c8d83e5 100644 --- a/R/bart.R +++ b/R/bart.R @@ -42,7 +42,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("bart")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("bart") #' #' bart(mode = "regression", trees = 5) diff --git a/R/boost_tree.R b/R/boost_tree.R index 6e65ea8e0..60c0417a8 100644 --- a/R/boost_tree.R +++ b/R/boost_tree.R @@ -47,7 +47,7 @@ #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("boost_tree")}, #' [xgb_train()], [C5.0_train()] #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("boost_tree") #' #' boost_tree(mode = "classification", trees = 20) diff --git a/R/c5_rules.R b/R/c5_rules.R index dbe519127..c48d0382b 100644 --- a/R/c5_rules.R +++ b/R/c5_rules.R @@ -39,7 +39,7 @@ #' @seealso [C50::C5.0()], [C50::C5.0Control()], #' \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("C5_rules")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("C5_rules") #' #' C5_rules() @@ -73,7 +73,7 @@ C5_rules <- #' #' @param object A `C5_rules` model specification. #' @inheritParams update.boost_tree -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #' # ------------------------------------------------------------------------------ #' diff --git a/R/condense_control.R b/R/condense_control.R index e9cc3e9cd..cdb077572 100644 --- a/R/condense_control.R +++ b/R/condense_control.R @@ -13,7 +13,7 @@ #' @keywords internal #' @export #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' ctrl <- control_parsnip(catch = TRUE) #' ctrl$allow_par <- TRUE #' str(ctrl) diff --git a/R/control_parsnip.R b/R/control_parsnip.R index 687fe51bb..5054b08d8 100644 --- a/R/control_parsnip.R +++ b/R/control_parsnip.R @@ -15,7 +15,7 @@ #' @return An S3 object with class "control_parsnip" that is a named list #' with the results of the function call #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' control_parsnip(verbosity = 2L) #' #' @export diff --git a/R/cubist_rules.R b/R/cubist_rules.R index ae6636f42..b1eb3f237 100644 --- a/R/cubist_rules.R +++ b/R/cubist_rules.R @@ -95,7 +95,7 @@ cubist_rules <- # ------------------------------------------------------------------------------ #' @param object A Cubist model specification. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #' # ------------------------------------------------------------------------------ #' diff --git a/R/data.R b/R/data.R index 52c59a01b..41b778416 100644 --- a/R/data.R +++ b/R/data.R @@ -8,7 +8,7 @@ #' @docType data #' @return \item{model_db}{a data frame} #' @keywords datasets internal -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' data(model_db) NULL diff --git a/R/decision_tree.R b/R/decision_tree.R index 3a8753813..e234e43de 100644 --- a/R/decision_tree.R +++ b/R/decision_tree.R @@ -26,7 +26,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("decision_tree")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("decision_tree") #' #' decision_tree(mode = "classification", tree_depth = 5) diff --git a/R/engine_docs.R b/R/engine_docs.R index a87735eb4..0ad656167 100644 --- a/R/engine_docs.R +++ b/R/engine_docs.R @@ -137,7 +137,7 @@ update_model_info_file <- function(path = "inst/models.tsv") { #' @name doc-tools #' @keywords internal #' @export -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' # See this file for step-by-step instructions. #' system.file("README-DOCS.md", package = "parsnip") #' diff --git a/R/engines.R b/R/engines.R index 270386c98..050f08dfc 100644 --- a/R/engines.R +++ b/R/engines.R @@ -90,7 +90,7 @@ load_libs <- function(x, quiet, attach = FALSE) { #' @param ... Any optional arguments associated with the chosen computational #' engine. These are captured as quosures and can be tuned with `tune()`. #' @return An updated model specification. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' # First, set main arguments using the standardized names #' logistic_reg(penalty = 0.01, mixture = 1/3) %>% #' # Now specify how you want to fit the model with another argument @@ -160,7 +160,7 @@ set_engine.default <- function(object, engine, ...) { #' @param x The name of a `parsnip` model (e.g., "linear_reg", "mars", etc.) #' @return A tibble. #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("linear_reg") #' @export show_engines <- function(x) { diff --git a/R/extract.R b/R/extract.R index 4a3b71c8b..4dbe4b0b7 100644 --- a/R/extract.R +++ b/R/extract.R @@ -41,7 +41,7 @@ #' section. #' #' @name extract-parsnip -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' lm_spec <- linear_reg() %>% set_engine("lm") #' lm_fit <- fit(lm_spec, mpg ~ ., data = mtcars) #' diff --git a/R/fit.R b/R/fit.R index ca74aa9ec..7ab57e425 100644 --- a/R/fit.R +++ b/R/fit.R @@ -55,7 +55,7 @@ #' a "reverse Kaplan-Meier" curve that models the probability of censoring. This #' may be used later to compute inverse probability censoring weights for #' performance measures. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' # Although `glm()` only has a formula interface, different #' # methods for specifying the model can be used #' diff --git a/R/fit_control.R b/R/fit_control.R index bea8b288e..b75795546 100644 --- a/R/fit_control.R +++ b/R/fit_control.R @@ -18,7 +18,7 @@ #' @return An S3 object with class "control_parsnip" that is a named list #' with the results of the function call #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' fit_control(verbosity = 2L) #' #' @details diff --git a/R/gen_additive_mod.R b/R/gen_additive_mod.R index f71036b1f..2633b9b78 100644 --- a/R/gen_additive_mod.R +++ b/R/gen_additive_mod.R @@ -24,7 +24,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("gen_additive_mod")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("gen_additive_mod") #' #' gen_additive_mod() diff --git a/R/grouped_binomial.R b/R/grouped_binomial.R index b3c7b12ca..56e38f292 100644 --- a/R/grouped_binomial.R +++ b/R/grouped_binomial.R @@ -21,7 +21,7 @@ #' @param ... Options to pass to [stats::glm()]. If `family` is not set, it will #' automatically be assigned the basic binomial family. #' @return A object produced by [stats::glm()]. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #---------------------------------------------------------------------------- #' # The same data set formatted three ways #' diff --git a/R/linear_reg.R b/R/linear_reg.R index 926d533a3..f7432bb95 100644 --- a/R/linear_reg.R +++ b/R/linear_reg.R @@ -33,7 +33,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("linear_reg")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("linear_reg") #' #' linear_reg() diff --git a/R/logistic_reg.R b/R/logistic_reg.R index 31c974167..92ca9333a 100644 --- a/R/logistic_reg.R +++ b/R/logistic_reg.R @@ -40,7 +40,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("logistic_reg")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("logistic_reg") #' #' logistic_reg() diff --git a/R/mars.R b/R/mars.R index 767cbd7a2..3a29f0f70 100644 --- a/R/mars.R +++ b/R/mars.R @@ -25,7 +25,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("mars")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("mars") #' #' mars(mode = "regression", num_terms = 5) diff --git a/R/misc.R b/R/misc.R index 7e6a7c469..4d3aad198 100644 --- a/R/misc.R +++ b/R/misc.R @@ -526,3 +526,20 @@ check_for_newdata <- function(..., call = rlang::caller_env()) { ) } } + + +# ------------------------------------------------------------------------------ + +# driven by https://github.com/Rdatatable/data.table/issues/5658 +# nocov start +# adapted from ps:::is_cran_check() +is_cran_check <- function() { + if (identical(Sys.getenv("NOT_CRAN"), "true")) { + FALSE + } + else { + Sys.getenv("_R_CHECK_PACKAGE_NAME_", "") != "" + } +} +# nocov end + diff --git a/R/mlp.R b/R/mlp.R index d1b2e9bfa..1f134ffcb 100644 --- a/R/mlp.R +++ b/R/mlp.R @@ -30,7 +30,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("mlp")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("mlp") #' #' mlp(mode = "classification", penalty = 0.01) diff --git a/R/model_object_docs.R b/R/model_object_docs.R index 669f984d2..6b59f35d0 100644 --- a/R/model_object_docs.R +++ b/R/model_object_docs.R @@ -175,7 +175,7 @@ NULL #' stores model objects after seeing the data and applying a model. #' @rdname model_fit #' @name model_fit -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #' # Keep the `x` matrix if the data are not too big. #' spec_obj <- diff --git a/R/multinom_reg.R b/R/multinom_reg.R index f2697d36f..a4ac39b14 100644 --- a/R/multinom_reg.R +++ b/R/multinom_reg.R @@ -40,7 +40,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("multinom_reg")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("multinom_reg") #' #' multinom_reg() diff --git a/R/nearest_neighbor.R b/R/nearest_neighbor.R index a50dfcdd4..814673ef1 100644 --- a/R/nearest_neighbor.R +++ b/R/nearest_neighbor.R @@ -29,7 +29,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("nearest_neighbor")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("nearest_neighbor") #' #' nearest_neighbor(neighbors = 11) diff --git a/R/nullmodel.R b/R/nullmodel.R index 7f664fdcb..844310690 100644 --- a/R/nullmodel.R +++ b/R/nullmodel.R @@ -32,7 +32,7 @@ #' `predict.nullmodel()` returns either a factor or numeric vector #' depending on the class of \code{y}. All predictions are always the same. #' @keywords models internal -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #' outcome <- factor(sample(letters[1:2], #' size = 100, @@ -140,7 +140,7 @@ predict.nullmodel <- function (object, new_data = NULL, type = NULL, ...) { #' @includeRmd man/rmd/null-model.md details #' #' @seealso [fit.model_spec()] -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' null_model(mode = "regression") #' @export null_model <- @@ -178,7 +178,7 @@ null_model <- #' @return A tibble with column `value`. #' @export #' @keywords internal -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #' nullmodel(mtcars[,-1], mtcars$mpg) %>% tidy() diff --git a/R/partykit.R b/R/partykit.R index f6082e669..3ff8907a3 100644 --- a/R/partykit.R +++ b/R/partykit.R @@ -26,7 +26,7 @@ #' @param ntree Number of trees to grow in a forest. #' @param ... Other options to pass to [partykit::ctree()] or [partykit::cforest()]. #' @return An object of class `party` (for `ctree`) or `cforest`. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' if (rlang::is_installed(c("modeldata", "partykit"))) { #' data(bivariate, package = "modeldata") #' ctree_train(Class ~ ., data = bivariate_train) @@ -184,7 +184,7 @@ cforest_train <- #' @param formula A model formula. #' @param data The training set (data frame). #' @return A value for `mtry`. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' # should be 9 #' max_mtry_formula(200, cbind(wt, mpg) ~ ., data = mtcars) #' @export diff --git a/R/pls.R b/R/pls.R index 8f697b7f1..5b1d82b1d 100644 --- a/R/pls.R +++ b/R/pls.R @@ -54,7 +54,7 @@ pls <- #' @param ... Not used for `update()`. #' @param fresh A logical for whether the arguments should be #' modified in-place of or replaced wholesale. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' model <- pls(predictor_prop = 0.1) #' model #' update(model, predictor_prop = 1) diff --git a/R/predict.R b/R/predict.R index 996d663f2..327bd80ef 100644 --- a/R/predict.R +++ b/R/predict.R @@ -114,7 +114,7 @@ #' multivariate models. #' @references #' \url{https://www.tidymodels.org/learn/statistics/survival-metrics/} -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' library(dplyr) #' #' lm_model <- diff --git a/R/proportional_hazards.R b/R/proportional_hazards.R index 576e70715..b144ff4a3 100644 --- a/R/proportional_hazards.R +++ b/R/proportional_hazards.R @@ -27,7 +27,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("proportional_hazards")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("proportional_hazards") #' #' proportional_hazards(mode = "censored regression") diff --git a/R/rand_forest.R b/R/rand_forest.R index 19d368718..43d1331d8 100644 --- a/R/rand_forest.R +++ b/R/rand_forest.R @@ -27,7 +27,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("rand_forest")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("rand_forest") #' #' rand_forest(mode = "classification", trees = 2000) diff --git a/R/repair_call.R b/R/repair_call.R index 2450b2120..de6d5741f 100644 --- a/R/repair_call.R +++ b/R/repair_call.R @@ -13,7 +13,7 @@ #' is the data frame that was given to `parsnip` for the model fit (i.e., the #' training set data). The name of this data object is inserted into the call. #' @return A modified `parsnip` fitted model. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #' fitted_model <- #' linear_reg() %>% diff --git a/R/required_pkgs.R b/R/required_pkgs.R index b49cad368..a68420ed4 100644 --- a/R/required_pkgs.R +++ b/R/required_pkgs.R @@ -5,7 +5,7 @@ #' @param ... Not used. #' @return A character vector #' @name required_pkgs.model_spec -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' should_fail <- try(required_pkgs(linear_reg(engine = NULL)), silent = TRUE) #' should_fail #' diff --git a/R/rule_fit.R b/R/rule_fit.R index 44f6257c2..af6be8347 100644 --- a/R/rule_fit.R +++ b/R/rule_fit.R @@ -29,7 +29,7 @@ #' #' @seealso [xrf::xrf.formula()], \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("rule_fit")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("rule_fit") #' #' rule_fit() @@ -73,7 +73,7 @@ rule_fit <- # ------------------------------------------------------------------------------ #' @param object A `rule_fit` model specification. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' # ------------------------------------------------------------------------------ #' #' model <- rule_fit(trees = 10, min_n = 2) diff --git a/R/survival_reg.R b/R/survival_reg.R index f2999a7a5..fff9b179a 100644 --- a/R/survival_reg.R +++ b/R/survival_reg.R @@ -25,7 +25,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("survival_reg")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("survival_reg") #' #' survival_reg(mode = "censored regression", dist = "weibull") diff --git a/R/svm_linear.R b/R/svm_linear.R index 23832f22f..4d3a27fa4 100644 --- a/R/svm_linear.R +++ b/R/svm_linear.R @@ -26,7 +26,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("svm_linear")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("svm_linear") #' #' svm_linear(mode = "classification") diff --git a/R/svm_poly.R b/R/svm_poly.R index 876d9260a..c9bdce79f 100644 --- a/R/svm_poly.R +++ b/R/svm_poly.R @@ -29,7 +29,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("svm_poly")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("svm_poly") #' #' svm_poly(mode = "classification", degree = 1.2) diff --git a/R/svm_rbf.R b/R/svm_rbf.R index 5a10f2d66..eb6cc7c60 100644 --- a/R/svm_rbf.R +++ b/R/svm_rbf.R @@ -31,7 +31,7 @@ #' #' @seealso \Sexpr[stage=render,results=rd]{parsnip:::make_seealso_list("svm_rbf")} #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' show_engines("svm_rbf") #' #' svm_rbf(mode = "classification", rbf_sigma = 0.2) diff --git a/R/translate.R b/R/translate.R index 287b3e5ec..6abe049e0 100644 --- a/R/translate.R +++ b/R/translate.R @@ -27,7 +27,7 @@ #' to understand what the underlying syntax would be. It should not be used #' to modify the model specification. #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' lm_spec <- linear_reg(penalty = 0.01) #' #' # `penalty` is tranlsated to `lambda` @@ -177,7 +177,7 @@ add_methods <- function(x, engine) { #' or in a list that can facilitate renaming grid objects? #' @return A tibble with columns `user`, `parsnip`, and `engine`, or a list #' with named character vectors `user_to_parsnip` and `parsnip_to_engine`. -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' mod <- #' linear_reg(penalty = tune("regularization"), mixture = tune()) %>% #' set_engine("glmnet") diff --git a/R/update.R b/R/update.R index 17a161464..7fe402575 100644 --- a/R/update.R +++ b/R/update.R @@ -29,7 +29,7 @@ #' modified in-place or replaced wholesale. #' @return An updated model specification. #' @name parsnip_update -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' model <- boost_tree(mtry = 10, min_n = 3) #' model #' update(model, mtry = 1) diff --git a/R/varying.R b/R/varying.R index 571b91f54..53b7ca724 100644 --- a/R/varying.R +++ b/R/varying.R @@ -38,7 +38,7 @@ generics::varying_args #' contains _any_ varying value (`varying`), the `id` for the object (`id`), #' and the class that was used to call the method (`type`). #' -#' @examples +#' @examplesIf !parsnip:::is_cran_check() #' #' # List all possible varying args for the random forest spec #' rand_forest() %>% varying_args() diff --git a/man/C5_rules.Rd b/man/C5_rules.Rd index 2dbb3b896..83f60ee69 100644 --- a/man/C5_rules.Rd +++ b/man/C5_rules.Rd @@ -55,9 +55,11 @@ C5_rules(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("C5_rules") C5_rules() +\dontshow{\}) # examplesIf} } \references{ Quinlan R (1993). \emph{C4.5: Programs for Machine Learning}. Morgan diff --git a/man/add_rowindex.Rd b/man/add_rowindex.Rd index b8599cf2d..cfea6afba 100644 --- a/man/add_rowindex.Rd +++ b/man/add_rowindex.Rd @@ -16,5 +16,7 @@ The same data frame with a column of 1-based integers named \code{.row}. Add a column of row numbers to a data frame } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} mtcars \%>\% add_rowindex() +\dontshow{\}) # examplesIf} } diff --git a/man/augment.Rd b/man/augment.Rd index 53ef834a2..100645abd 100644 --- a/man/augment.Rd +++ b/man/augment.Rd @@ -49,6 +49,7 @@ metrics in the \pkg{yardstick} package. } } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} car_trn <- mtcars[11:32,] car_tst <- mtcars[ 1:10,] @@ -88,7 +89,7 @@ augment(cls_form, cls_tst[, -3]) augment(cls_xy, cls_tst) augment(cls_xy, cls_tst[, -3]) - +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org/learn/statistics/survival-metrics/} diff --git a/man/bart.Rd b/man/bart.Rd index 7fbe0af39..ac05e9005 100644 --- a/man/bart.Rd +++ b/man/bart.Rd @@ -75,6 +75,7 @@ bart(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("bart") bart(mode = "regression", trees = 5) @@ -98,6 +99,7 @@ prior_test(coef = c(0.05, 0.5, .95), expo = c(1/2, 1, 2)) \%>\% geom_line() + geom_point() + facet_wrap(~ expo) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/boost_tree.Rd b/man/boost_tree.Rd index eda8d2a2c..a81df53ab 100644 --- a/man/boost_tree.Rd +++ b/man/boost_tree.Rd @@ -81,9 +81,11 @@ boost_tree(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("boost_tree") boost_tree(mode = "classification", trees = 20) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/condense_control.Rd b/man/condense_control.Rd index 865102bb9..326dae09b 100644 --- a/man/condense_control.Rd +++ b/man/condense_control.Rd @@ -22,11 +22,13 @@ throughout the tidymodels packages. It is now assumed that each control function is either a subset or a superset of another control function. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} ctrl <- control_parsnip(catch = TRUE) ctrl$allow_par <- TRUE str(ctrl) ctrl <- condense_control(ctrl, control_parsnip()) str(ctrl) +\dontshow{\}) # examplesIf} } \keyword{internal} diff --git a/man/control_parsnip.Rd b/man/control_parsnip.Rd index 435597d2f..a281331c8 100644 --- a/man/control_parsnip.Rd +++ b/man/control_parsnip.Rd @@ -27,6 +27,7 @@ Pass options to the \code{\link[=fit.model_spec]{fit.model_spec()}} function to output and computations } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} control_parsnip(verbosity = 2L) - +\dontshow{\}) # examplesIf} } diff --git a/man/ctree_train.Rd b/man/ctree_train.Rd index 782ecb58e..dc0cf484b 100644 --- a/man/ctree_train.Rd +++ b/man/ctree_train.Rd @@ -74,9 +74,11 @@ These functions are slightly different APIs for \code{\link[partykit:ctree]{part arguments (as opposed to being specified in \code{\link[partykit:ctree_control]{partykit::ctree_control()}}). } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} if (rlang::is_installed(c("modeldata", "partykit"))) { data(bivariate, package = "modeldata") ctree_train(Class ~ ., data = bivariate_train) ctree_train(Class ~ ., data = bivariate_train, maxdepth = 1) } +\dontshow{\}) # examplesIf} } diff --git a/man/decision_tree.Rd b/man/decision_tree.Rd index ee78f24bb..f0ae8fce7 100644 --- a/man/decision_tree.Rd +++ b/man/decision_tree.Rd @@ -56,9 +56,11 @@ decision_tree(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("decision_tree") decision_tree(mode = "classification", tree_depth = 5) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/doc-tools.Rd b/man/doc-tools.Rd index 0660eb0ca..7257c6a3b 100644 --- a/man/doc-tools.Rd +++ b/man/doc-tools.Rd @@ -50,6 +50,7 @@ the References section). Most parsnip users will not need to use these functions or documentation. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # See this file for step-by-step instructions. system.file("README-DOCS.md", package = "parsnip") @@ -57,6 +58,7 @@ system.file("README-DOCS.md", package = "parsnip") make_engine_list("linear_reg") cat(make_engine_list("linear_reg")) +\dontshow{\}) # examplesIf} } \references{ \url{https://github.com/tidymodels/parsnip/blob/main/inst/README-DOCS.md} diff --git a/man/dot-model_param_name_key.Rd b/man/dot-model_param_name_key.Rd index 1395bb9f0..31372ae8e 100644 --- a/man/dot-model_param_name_key.Rd +++ b/man/dot-model_param_name_key.Rd @@ -22,6 +22,7 @@ tuning parameter names, the standardized parsnip parameter names, and the argument names to the underlying fit function for the engine. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} mod <- linear_reg(penalty = tune("regularization"), mixture = tune()) \%>\% set_engine("glmnet") @@ -39,4 +40,5 @@ grid \%>\% grid \%>\% dplyr::rename(!!!rn$user_to_parsnip) \%>\% dplyr::rename(!!!rn$parsnip_to_engine) +\dontshow{\}) # examplesIf} } diff --git a/man/extract-parsnip.Rd b/man/extract-parsnip.Rd index a9a8d8b60..f926c7848 100644 --- a/man/extract-parsnip.Rd +++ b/man/extract-parsnip.Rd @@ -60,6 +60,7 @@ or silently generating incorrect predictions. }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm_spec <- linear_reg() \%>\% set_engine("lm") lm_fit <- fit(lm_spec, mpg ~ ., data = mtcars) @@ -68,4 +69,5 @@ extract_spec_parsnip(lm_fit) extract_fit_engine(lm_fit) lm(mpg ~ ., data = mtcars) +\dontshow{\}) # examplesIf} } diff --git a/man/fit.Rd b/man/fit.Rd index 8beaa02f0..b4c16f278 100644 --- a/man/fit.Rd +++ b/man/fit.Rd @@ -105,6 +105,7 @@ may be used later to compute inverse probability censoring weights for performance measures. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Although `glm()` only has a formula interface, different # methods for specifying the model can be used @@ -127,6 +128,7 @@ using_xy <- using_formula using_xy +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=set_engine]{set_engine()}}, \code{\link[=control_parsnip]{control_parsnip()}}, \code{model_spec}, \code{model_fit} diff --git a/man/fit_control.Rd b/man/fit_control.Rd index e2b015c1a..aba2781d9 100644 --- a/man/fit_control.Rd +++ b/man/fit_control.Rd @@ -32,7 +32,8 @@ output and computations \code{fit_control()} is deprecated in favor of \code{control_parsnip()}. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} fit_control(verbosity = 2L) - +\dontshow{\}) # examplesIf} } \keyword{internal} diff --git a/man/gen_additive_mod.Rd b/man/gen_additive_mod.Rd index 9ee1dd704..8829dcb3f 100644 --- a/man/gen_additive_mod.Rd +++ b/man/gen_additive_mod.Rd @@ -54,10 +54,11 @@ gen_additive_mod(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("gen_additive_mod") gen_additive_mod() - +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/get_model_env.Rd b/man/get_model_env.Rd index 0782a5073..3b20d554d 100644 --- a/man/get_model_env.Rd +++ b/man/get_model_env.Rd @@ -29,10 +29,11 @@ These functions read and write to the environment where the package stores information about model specifications. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Access the model data: current_code <- get_model_env() ls(envir = current_code) - +\dontshow{\}) # examplesIf} } \references{ "How to build a parsnip model" diff --git a/man/glm_grouped.Rd b/man/glm_grouped.Rd index f4b33494d..d79f3655d 100644 --- a/man/glm_grouped.Rd +++ b/man/glm_grouped.Rd @@ -36,6 +36,7 @@ each factor level so that the outcome can be given to the formula as "number of events" format for binomial data. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} #---------------------------------------------------------------------------- # The same data set formatted three ways @@ -87,4 +88,5 @@ glm( # The new function that starts with frequency weights and gets the correct place: glm_grouped(Admit ~ Gender + Dept, data = ucb_weighted, weights = ucb_weighted$Freq) +\dontshow{\}) # examplesIf} } diff --git a/man/has_multi_predict.Rd b/man/has_multi_predict.Rd index e6d613bf6..450d26667 100644 --- a/man/has_multi_predict.Rd +++ b/man/has_multi_predict.Rd @@ -44,6 +44,7 @@ returns the names of the arguments to \code{multi_predict()} for this model (if any). } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm_model_idea <- linear_reg() \%>\% set_engine("lm") has_multi_predict(lm_model_idea) lm_model_fit <- fit(lm_model_idea, mpg ~ ., data = mtcars) @@ -61,5 +62,6 @@ knn_fit <- multi_predict_args(knn_fit) multi_predict(knn_fit, mtcars[1, -1], neighbors = 1:4)$.pred +\dontshow{\}) # examplesIf} } \keyword{internal} diff --git a/man/linear_reg.Rd b/man/linear_reg.Rd index 9b297c71c..e34f45652 100644 --- a/man/linear_reg.Rd +++ b/man/linear_reg.Rd @@ -54,9 +54,11 @@ linear_reg(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("linear_reg") linear_reg() +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/logistic_reg.Rd b/man/logistic_reg.Rd index f77b5ccaf..b0e464906 100644 --- a/man/logistic_reg.Rd +++ b/man/logistic_reg.Rd @@ -67,9 +67,11 @@ This model fits a classification model for binary outcomes; for multiclass outcomes, see \code{\link[=multinom_reg]{multinom_reg()}}. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("logistic_reg") logistic_reg() +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/mars.Rd b/man/mars.Rd index 051d49709..2b893b066 100644 --- a/man/mars.Rd +++ b/man/mars.Rd @@ -56,9 +56,11 @@ mars(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("mars") mars(mode = "regression", num_terms = 5) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/max_mtry_formula.Rd b/man/max_mtry_formula.Rd index 52990f57a..6dbe33e76 100644 --- a/man/max_mtry_formula.Rd +++ b/man/max_mtry_formula.Rd @@ -24,6 +24,8 @@ This function potentially caps the value of \code{mtry} based on a formula and data set. This is a safe approach for survival and/or multivariate models. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # should be 9 max_mtry_formula(200, cbind(wt, mpg) ~ ., data = mtcars) +\dontshow{\}) # examplesIf} } diff --git a/man/min_cols.Rd b/man/min_cols.Rd index c4e6ce53b..a6b7307f3 100644 --- a/man/min_cols.Rd +++ b/man/min_cols.Rd @@ -31,6 +31,7 @@ fit. These functions check the possible range of the data and adjust them if needed (with a warning). } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} nearest_neighbor(neighbors= 100) \%>\% set_engine("kknn") \%>\% set_mode("regression") \%>\% @@ -41,4 +42,5 @@ rand_forest(mtry = 2, min_n = 100, trees = 3) \%>\% set_engine("ranger") \%>\% set_mode("regression") \%>\% fit(mpg ~ ., data = mtcars) +\dontshow{\}) # examplesIf} } diff --git a/man/mlp.Rd b/man/mlp.Rd index c47cf465a..a1d38279b 100644 --- a/man/mlp.Rd +++ b/man/mlp.Rd @@ -71,9 +71,11 @@ mlp(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("mlp") mlp(mode = "classification", penalty = 0.01) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/model_db.Rd b/man/model_db.Rd index 974f12a8c..ec674b9ea 100644 --- a/man/model_db.Rd +++ b/man/model_db.Rd @@ -12,7 +12,9 @@ This is used in the RStudio add-in and captures information about mode specifications in various R packages. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(model_db) +\dontshow{\}) # examplesIf} } \keyword{datasets} \keyword{internal} diff --git a/man/model_fit.Rd b/man/model_fit.Rd index 83b88820a..46c89fe44 100644 --- a/man/model_fit.Rd +++ b/man/model_fit.Rd @@ -35,6 +35,7 @@ This class and structure is the basis for how \pkg{parsnip} stores model objects after seeing the data and applying a model. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Keep the `x` matrix if the data are not too big. spec_obj <- @@ -46,4 +47,5 @@ fit_obj <- fit(spec_obj, mpg ~ ., data = mtcars) fit_obj nrow(fit_obj$fit$x) +\dontshow{\}) # examplesIf} } diff --git a/man/multinom_reg.Rd b/man/multinom_reg.Rd index 6aca4284e..7f6314f26 100644 --- a/man/multinom_reg.Rd +++ b/man/multinom_reg.Rd @@ -66,9 +66,11 @@ This model fits a classification model for multiclass outcomes; for binary outcomes, see \code{\link[=logistic_reg]{logistic_reg()}}. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("multinom_reg") multinom_reg() +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/nearest_neighbor.Rd b/man/nearest_neighbor.Rd index 82d7db48e..9aadaa6b9 100644 --- a/man/nearest_neighbor.Rd +++ b/man/nearest_neighbor.Rd @@ -60,10 +60,11 @@ nearest_neighbor(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("nearest_neighbor") nearest_neighbor(neighbors = 11) - +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/null_model.Rd b/man/null_model.Rd index 916d80ca9..3f9775c02 100644 --- a/man/null_model.Rd +++ b/man/null_model.Rd @@ -56,7 +56,9 @@ call. For this type of model, the template of the fit calls are below: } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} null_model(mode = "regression") +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=fit.model_spec]{fit.model_spec()}} diff --git a/man/nullmodel.Rd b/man/nullmodel.Rd index 4a5351052..7585422de 100644 --- a/man/nullmodel.Rd +++ b/man/nullmodel.Rd @@ -57,6 +57,7 @@ probabilities are requested, the percentage of the training set samples with the most prevalent class is returned. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} outcome <- factor(sample(letters[1:2], size = 100, @@ -65,7 +66,7 @@ outcome <- factor(sample(letters[1:2], useless <- nullmodel(y = outcome) useless predict(useless, matrix(NA, nrow = 5)) - +\dontshow{\}) # examplesIf} } \keyword{internal} \keyword{models} diff --git a/man/parsnip_update.Rd b/man/parsnip_update.Rd index f95e05836..ab3f67a93 100644 --- a/man/parsnip_update.Rd +++ b/man/parsnip_update.Rd @@ -471,6 +471,7 @@ If parameters of a model specification need to be modified, \code{update()} can be used in lieu of recreating the object from scratch. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # ------------------------------------------------------------------------------ @@ -478,6 +479,8 @@ model <- C5_rules(trees = 10, min_n = 2) model update(model, trees = 1) update(model, trees = 1, fresh = TRUE) +\dontshow{\}) # examplesIf} +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # ------------------------------------------------------------------------------ @@ -485,16 +488,22 @@ model <- cubist_rules(committees = 10, neighbors = 2) model update(model, committees = 1) update(model, committees = 1, fresh = TRUE) +\dontshow{\}) # examplesIf} +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} model <- pls(predictor_prop = 0.1) model update(model, predictor_prop = 1) update(model, predictor_prop = 1, fresh = TRUE) +\dontshow{\}) # examplesIf} +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # ------------------------------------------------------------------------------ model <- rule_fit(trees = 10, min_n = 2) model update(model, trees = 1) update(model, trees = 1, fresh = TRUE) +\dontshow{\}) # examplesIf} +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} model <- boost_tree(mtry = 10, min_n = 3) model update(model, mtry = 1) @@ -513,5 +522,5 @@ model <- linear_reg(penalty = 10, mixture = 0.1) model update(model, penalty = 1) update(model, penalty = 1, fresh = TRUE) - +\dontshow{\}) # examplesIf} } diff --git a/man/predict.model_fit.Rd b/man/predict.model_fit.Rd index 10e3854e5..eaf3364ef 100644 --- a/man/predict.model_fit.Rd +++ b/man/predict.model_fit.Rd @@ -138,6 +138,7 @@ produces. Set \code{increasing = FALSE} to suppress this behavior. } } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(dplyr) lm_model <- @@ -165,6 +166,7 @@ predict( type = "raw", opts = list(type = "terms") ) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org/learn/statistics/survival-metrics/} diff --git a/man/proportional_hazards.Rd b/man/proportional_hazards.Rd index 0ba951ccc..de1b966ee 100644 --- a/man/proportional_hazards.Rd +++ b/man/proportional_hazards.Rd @@ -65,9 +65,11 @@ survival model be specified via the formula interface. Proportional hazards models include the Cox model. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("proportional_hazards") proportional_hazards(mode = "censored regression") +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/rand_forest.Rd b/man/rand_forest.Rd index d5efd9111..aaae5dddc 100644 --- a/man/rand_forest.Rd +++ b/man/rand_forest.Rd @@ -58,9 +58,11 @@ rand_forest(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("rand_forest") rand_forest(mode = "classification", trees = 2000) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/repair_call.Rd b/man/repair_call.Rd index 5e1eb41ba..cc0653fda 100644 --- a/man/repair_call.Rd +++ b/man/repair_call.Rd @@ -28,6 +28,7 @@ other functions. For example, some arguments may still be quosures and the functions and methods. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} fitted_model <- linear_reg() \%>\% @@ -40,4 +41,5 @@ fitted_model$fit$call # All better: repair_call(fitted_model, mtcars)$fit$call +\dontshow{\}) # examplesIf} } diff --git a/man/required_pkgs.model_spec.Rd b/man/required_pkgs.model_spec.Rd index 9ab20d6f1..5e490b87e 100644 --- a/man/required_pkgs.model_spec.Rd +++ b/man/required_pkgs.model_spec.Rd @@ -23,6 +23,7 @@ A character vector Determine required packages for a model } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} should_fail <- try(required_pkgs(linear_reg(engine = NULL)), silent = TRUE) should_fail @@ -38,4 +39,5 @@ linear_reg() \%>\% set_engine("lm") \%>\% fit(mpg ~ ., data = mtcars) \%>\% required_pkgs() +\dontshow{\}) # examplesIf} } diff --git a/man/rule_fit.Rd b/man/rule_fit.Rd index 229246f5f..6bd0c4aca 100644 --- a/man/rule_fit.Rd +++ b/man/rule_fit.Rd @@ -89,10 +89,11 @@ rule_fit(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("rule_fit") rule_fit() - +\dontshow{\}) # examplesIf} } \references{ Friedman, J. H., and Popescu, B. E. (2008). "Predictive learning diff --git a/man/set_args.Rd b/man/set_args.Rd index 57e59a60c..7e6c678d6 100644 --- a/man/set_args.Rd +++ b/man/set_args.Rd @@ -28,10 +28,11 @@ An updated model object. \code{set_args()} will replace existing values of the arguments. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} rand_forest() rand_forest() \%>\% set_args(mtry = 3, importance = TRUE) \%>\% set_mode("regression") - +\dontshow{\}) # examplesIf} } diff --git a/man/set_engine.Rd b/man/set_engine.Rd index fbc0065f6..327b7ed34 100644 --- a/man/set_engine.Rd +++ b/man/set_engine.Rd @@ -54,6 +54,7 @@ argument to be passed directly to the engine fitting function, like } } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # First, set main arguments using the standardized names logistic_reg(penalty = 0.01, mixture = 1/3) \%>\% # Now specify how you want to fit the model with another argument @@ -65,5 +66,5 @@ decision_tree(tree_depth = 5) \%>\% set_engine("rpart", parms = list(prior = c(.65,.35))) \%>\% set_mode("classification") \%>\% translate() - +\dontshow{\}) # examplesIf} } diff --git a/man/set_new_model.Rd b/man/set_new_model.Rd index f77ccd712..0f0435a06 100644 --- a/man/set_new_model.Rd +++ b/man/set_new_model.Rd @@ -145,10 +145,12 @@ accommodate a sparse matrix representation for predictors during fitting and tuning. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # set_new_model("shallow_learning_model") # Show the information about a model: show_model_info("rand_forest") +\dontshow{\}) # examplesIf} } \references{ "How to build a parsnip model" diff --git a/man/show_engines.Rd b/man/show_engines.Rd index 36c408c68..cd4ba6c37 100644 --- a/man/show_engines.Rd +++ b/man/show_engines.Rd @@ -19,5 +19,7 @@ the \pkg{poissonreg} package adds additional engines for the \code{\link[=poisso model and these are not available unless \pkg{poissonreg} is loaded. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("linear_reg") +\dontshow{\}) # examplesIf} } diff --git a/man/survival_reg.Rd b/man/survival_reg.Rd index c2f4cee0b..286b5f989 100644 --- a/man/survival_reg.Rd +++ b/man/survival_reg.Rd @@ -47,9 +47,11 @@ Since survival models typically involve censoring (and require the use of survival model be specified via the formula interface. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("survival_reg") survival_reg(mode = "censored regression", dist = "weibull") +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/svm_linear.Rd b/man/svm_linear.Rd index 1f914f8ff..4a0ff97e4 100644 --- a/man/svm_linear.Rd +++ b/man/svm_linear.Rd @@ -50,9 +50,11 @@ svm_linear(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("svm_linear") svm_linear(mode = "classification") +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/svm_poly.Rd b/man/svm_poly.Rd index 9f49d9aea..071dac91e 100644 --- a/man/svm_poly.Rd +++ b/man/svm_poly.Rd @@ -62,9 +62,11 @@ svm_poly(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("svm_poly") svm_poly(mode = "classification", degree = 1.2) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/svm_rbf.Rd b/man/svm_rbf.Rd index 6e73ebcec..3be0777b1 100644 --- a/man/svm_rbf.Rd +++ b/man/svm_rbf.Rd @@ -60,9 +60,11 @@ svm_rbf(argument = !!value) }\if{html}{\out{}} } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} show_engines("svm_rbf") svm_rbf(mode = "classification", rbf_sigma = 0.2) +\dontshow{\}) # examplesIf} } \references{ \url{https://www.tidymodels.org}, \href{https://www.tmwr.org/}{\emph{Tidy Modeling with R}}, \href{https://www.tidymodels.org/find/parsnip/}{searchable table of parsnip models} diff --git a/man/tidy.nullmodel.Rd b/man/tidy.nullmodel.Rd index 6f5b3566a..eb08f7fe6 100644 --- a/man/tidy.nullmodel.Rd +++ b/man/tidy.nullmodel.Rd @@ -18,7 +18,9 @@ A tibble with column \code{value}. Return the results of \code{nullmodel} as a tibble } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} nullmodel(mtcars[,-1], mtcars$mpg) \%>\% tidy() +\dontshow{\}) # examplesIf} } \keyword{internal} diff --git a/man/translate.Rd b/man/translate.Rd index af910bb9e..4aa50d4d8 100644 --- a/man/translate.Rd +++ b/man/translate.Rd @@ -42,6 +42,7 @@ to understand what the underlying syntax would be. It should not be used to modify the model specification. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm_spec <- linear_reg(penalty = 0.01) # `penalty` is tranlsated to `lambda` @@ -55,5 +56,5 @@ translate(lm_spec, engine = "spark") # with a placeholder for an unknown argument value: translate(linear_reg(penalty = tune(), mixture = tune()), engine = "glmnet") - +\dontshow{\}) # examplesIf} } diff --git a/man/varying_args.Rd b/man/varying_args.Rd index cf2d5ac1e..2e0b997cb 100644 --- a/man/varying_args.Rd +++ b/man/varying_args.Rd @@ -38,6 +38,7 @@ or a \code{recipe} is used. For a \code{model_spec}, the first class is used. Fo a \code{recipe}, the unique step \code{id} is used. } \examples{ +\dontshow{if (!parsnip:::is_cran_check()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # List all possible varying args for the random forest spec rand_forest() \%>\% varying_args() @@ -62,6 +63,6 @@ rand_forest() \%>\% sampsize = varying() ) \%>\% varying_args() - +\dontshow{\}) # examplesIf} } \keyword{internal}