diff --git a/DESCRIPTION b/DESCRIPTION index 6215be2..114c326 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -4,27 +4,27 @@ Version: 0.0.0.9000 Authors@R: person("Emil", "Hvitfeldt", , "emil.hvitfeldt@posit.co", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-0679-1945")) -Description: Turning tidymodels workflows into series of equations, to allow - for low dependency prediction locally or in databases. +Description: Turning tidymodels workflows into series of equations, to + allow for low dependency prediction locally or in databases. License: MIT + file LICENSE -Encoding: UTF-8 -Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1.9000 +URL: https://github.com/EmilHvitfeldt/orbital +BugReports: https://github.com/EmilHvitfeldt/orbital/issues Imports: cli, - recipes (>= 1.0.10.9000), - rlang, - tidypredict, - workflows + rlang Suggests: dbplyr, - dtplyr, dplyr, + dtplyr, jsonlite, parsnip, - testthat (>= 3.0.0) -URL: https://github.com/EmilHvitfeldt/orbital -BugReports: https://github.com/EmilHvitfeldt/orbital/issues -Config/testthat/edition: 3 + recipes (>= 1.0.10.9000), + testthat (>= 3.0.0), + tidypredict, + workflows Remotes: tidymodels/recipes +Config/testthat/edition: 3 +Encoding: UTF-8 +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.1.9000 diff --git a/R/dt.R b/R/dt.R index 8ba5232..00b9c37 100644 --- a/R/dt.R +++ b/R/dt.R @@ -4,7 +4,7 @@ #' #' @returns data.table code. #' -#' @examplesIf rlang::is_installed(c("dbplyr", "dtplyr")) +#' @examplesIf rlang::is_installed(c("dbplyr", "dtplyr", "recipes", "tidypredict", "workflows")) #' #' library(workflows) #' library(recipes) diff --git a/R/inline.R b/R/inline.R index 118c434..7e8005c 100644 --- a/R/inline.R +++ b/R/inline.R @@ -10,7 +10,7 @@ #' #' @returns a list of quosures. #' -#' @examples +#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) diff --git a/R/json.R b/R/json.R index f7ffcec..e7c8323 100644 --- a/R/json.R +++ b/R/json.R @@ -7,7 +7,7 @@ #' #' @seealso [orbital_json_read()] #' -#' @examplesIf rlang::is_installed("jsonlite") +#' @examplesIf rlang::is_installed(c("jsonlite", "recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) @@ -46,7 +46,7 @@ orbital_json_write <- function(x, path) { #' #' @seealso [orbital_json_write()] #' -#' @examplesIf rlang::is_installed("jsonlite") +#' @examplesIf rlang::is_installed(c("jsonlite", "recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) diff --git a/R/mutate.R b/R/mutate.R index 76c1f02..a5cf29c 100644 --- a/R/mutate.R +++ b/R/mutate.R @@ -5,7 +5,7 @@ #' #' @returns A modified data frame. #' -#' @examples +#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) diff --git a/R/orbital.R b/R/orbital.R index 9b6bd3a..91a9411 100644 --- a/R/orbital.R +++ b/R/orbital.R @@ -5,7 +5,7 @@ #' #' @returns A orbital object. #' -#' @examples +#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) diff --git a/R/predict.R b/R/predict.R index 07e449f..c184d27 100644 --- a/R/predict.R +++ b/R/predict.R @@ -5,7 +5,7 @@ #' #' @returns A modified data frame. #' -#' @examples +#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) diff --git a/R/sql.R b/R/sql.R index 156aeb2..32a8935 100644 --- a/R/sql.R +++ b/R/sql.R @@ -5,7 +5,7 @@ #' #' @returns SQL code. #' -#' @examplesIf rlang::is_installed("dbplyr") +#' @examplesIf rlang::is_installed(c("dbplyr", "recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) diff --git a/R/to.R b/R/to.R index 4e24f14..76880c4 100644 --- a/R/to.R +++ b/R/to.R @@ -6,7 +6,7 @@ #' #' @returns A orbital object. #' -#' @examples +#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows")) #' library(workflows) #' library(recipes) #' library(parsnip) diff --git a/man/orbital.Rd b/man/orbital.Rd index 93b9ac9..5e300e4 100644 --- a/man/orbital.Rd +++ b/man/orbital.Rd @@ -18,6 +18,7 @@ A orbital object. Turn tidymodels workflows into equations } \examples{ +\dontshow{if (rlang::is_installed(c("recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) @@ -32,5 +33,5 @@ wf_spec <- workflow(rec_spec, lm_spec) wf_fit <- fit(wf_spec, mtcars) orbital(wf_fit) - +\dontshow{\}) # examplesIf} } diff --git a/man/orbital_dt.Rd b/man/orbital_dt.Rd index d741c13..977e244 100644 --- a/man/orbital_dt.Rd +++ b/man/orbital_dt.Rd @@ -16,7 +16,7 @@ data.table code. Convert to data.table code } \examples{ -\dontshow{if (rlang::is_installed(c("dbplyr", "dtplyr"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed(c("dbplyr", "dtplyr", "recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) diff --git a/man/orbital_inline.Rd b/man/orbital_inline.Rd index ddffd8c..7722417 100644 --- a/man/orbital_inline.Rd +++ b/man/orbital_inline.Rd @@ -21,6 +21,7 @@ This function is mostly going to be used for See examples for use cases. } \examples{ +\dontshow{if (rlang::is_installed(c("recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) @@ -40,4 +41,5 @@ library(dplyr) mtcars \%>\% mutate(!!!orbital_inline(orbital_obj)) +\dontshow{\}) # examplesIf} } diff --git a/man/orbital_json_read.Rd b/man/orbital_json_read.Rd index 8a758b0..62addc2 100644 --- a/man/orbital_json_read.Rd +++ b/man/orbital_json_read.Rd @@ -16,7 +16,7 @@ A orbital object Read orbital json file } \examples{ -\dontshow{if (rlang::is_installed("jsonlite")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed(c("jsonlite", "recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) diff --git a/man/orbital_json_write.Rd b/man/orbital_json_write.Rd index d85a360..237c101 100644 --- a/man/orbital_json_write.Rd +++ b/man/orbital_json_write.Rd @@ -18,7 +18,7 @@ nothing. Save as json file } \examples{ -\dontshow{if (rlang::is_installed("jsonlite")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed(c("jsonlite", "recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) diff --git a/man/orbital_predict.Rd b/man/orbital_predict.Rd index 195112a..c8e764e 100644 --- a/man/orbital_predict.Rd +++ b/man/orbital_predict.Rd @@ -24,6 +24,7 @@ Use orbital in a mutate way Use orbital in a mutate way } \examples{ +\dontshow{if (rlang::is_installed(c("recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) @@ -41,6 +42,8 @@ orbital_obj <- orbital(wf_fit) mtcars \%>\% orbital_predict(orbital_obj) +\dontshow{\}) # examplesIf} +\dontshow{if (rlang::is_installed(c("recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) @@ -58,4 +61,5 @@ orbital_obj <- orbital(wf_fit) mtcars \%>\% orbital_predict(orbital_obj) +\dontshow{\}) # examplesIf} } diff --git a/man/orbital_sql.Rd b/man/orbital_sql.Rd index a27a043..64d401a 100644 --- a/man/orbital_sql.Rd +++ b/man/orbital_sql.Rd @@ -18,7 +18,7 @@ SQL code. Convert to SQL code } \examples{ -\dontshow{if (rlang::is_installed("dbplyr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (rlang::is_installed(c("dbplyr", "recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) diff --git a/man/to_r_fun.Rd b/man/to_r_fun.Rd index a7e25a8..6a55eab 100644 --- a/man/to_r_fun.Rd +++ b/man/to_r_fun.Rd @@ -20,6 +20,7 @@ A orbital object. Turn orbital object into a R function } \examples{ +\dontshow{if (rlang::is_installed(c("recipes", "tidypredict", "workflows"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(workflows) library(recipes) library(parsnip) @@ -40,4 +41,5 @@ file_name <- tempfile() to_r_fun(orbital_obj, file = file_name) readLines(file_name) +\dontshow{\}) # examplesIf} } diff --git a/tests/testthat/test-dt.R b/tests/testthat/test-dt.R index 2641513..b5629bd 100644 --- a/tests/testthat/test-dt.R +++ b/tests/testthat/test-dt.R @@ -1,6 +1,10 @@ test_that("dt works", { + skip_if_not_installed("recipes") skip_if_not_installed("dbplyr") skip_if_not_installed("dtplyr") + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") + rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) diff --git a/tests/testthat/test-inline.R b/tests/testthat/test-inline.R index 9d5d458..7c35dc4 100644 --- a/tests/testthat/test-inline.R +++ b/tests/testthat/test-inline.R @@ -1,4 +1,8 @@ test_that("orbital works with workflows - recipe", { + skip_if_not_installed("recipes") + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") + rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) diff --git a/tests/testthat/test-json.R b/tests/testthat/test-json.R index d2fd806..e3bd030 100644 --- a/tests/testthat/test-json.R +++ b/tests/testthat/test-json.R @@ -1,5 +1,8 @@ test_that("read and write json works", { + skip_if_not_installed("recipes") + skip_if_not_installed("tidypredict") skip_if_not_installed("jsonlite") + skip_if_not_installed("workflows") rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) diff --git a/tests/testthat/test-orbital.R b/tests/testthat/test-orbital.R index 054cd66..a4969fa 100644 --- a/tests/testthat/test-orbital.R +++ b/tests/testthat/test-orbital.R @@ -1,4 +1,7 @@ test_that("orbital works with workflows - recipe", { + skip_if_not_installed("recipes") + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) @@ -19,6 +22,8 @@ test_that("orbital works with workflows - recipe", { }) test_that("orbital works with workflows - formula", { + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") lm_spec <- parsnip::linear_reg() wf_spec <- workflows::workflow() %>% @@ -36,6 +41,8 @@ test_that("orbital works with workflows - formula", { }) test_that("orbital works with workflows - variables", { + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") lm_spec <- parsnip::linear_reg() wf_spec <- workflows::workflow() %>% @@ -53,6 +60,8 @@ test_that("orbital works with workflows - variables", { }) test_that("orbital errors on non-trained workflow", { + skip_if_not_installed("recipes") + skip_if_not_installed("workflows") rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) @@ -67,6 +76,8 @@ test_that("orbital errors on non-trained workflow", { }) test_that("orbital works with recipe", { + skip_if_not_installed("tidypredict") + skip_if_not_installed("recipes") rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) @@ -80,6 +91,7 @@ test_that("orbital works with recipe", { }) test_that("orbital errors untrained recipe", { + skip_if_not_installed("recipes") rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) @@ -90,6 +102,7 @@ test_that("orbital errors untrained recipe", { }) test_that("orbital works with parsnip", { + skip_if_not_installed("tidypredict") lm_spec <- parsnip::linear_reg() lm_fit <- parsnip::fit(lm_spec, mpg ~ ., data = mtcars) @@ -102,6 +115,7 @@ test_that("orbital works with parsnip", { }) test_that("orbital errors on non-trained parsnip", { + skip_if_not_installed("parsnip") lm_spec <- parsnip::linear_reg() expect_snapshot( @@ -111,6 +125,7 @@ test_that("orbital errors on non-trained parsnip", { }) test_that("orbital errors nicely on post-processing", { + skip_if_not_installed("workflows") lm_spec <- parsnip::linear_reg() wf_spec <- workflows::workflow() %>% @@ -136,6 +151,9 @@ test_that("orbital errors on wrong input", { }) test_that("orbital printing works", { + skip_if_not_installed("recipes") + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) diff --git a/tests/testthat/test-predict.R b/tests/testthat/test-predict.R index f89180d..4081fb4 100644 --- a/tests/testthat/test-predict.R +++ b/tests/testthat/test-predict.R @@ -1,4 +1,7 @@ test_that("orbital works with workflows - recipe", { + skip_if_not_installed("recipes") + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors()) diff --git a/tests/testthat/test-sql.R b/tests/testthat/test-sql.R index e828784..5811d5c 100644 --- a/tests/testthat/test-sql.R +++ b/tests/testthat/test-sql.R @@ -1,5 +1,9 @@ test_that("sql works", { + skip_if_not_installed("recipes") skip_if_not_installed("dbplyr") + skip_if_not_installed("tidypredict") + skip_if_not_installed("workflows") + rec_spec <- recipes::recipe(mpg ~ ., data = mtcars) %>% recipes::step_normalize(recipes::all_numeric_predictors())