Skip to content

Commit

Permalink
Merge pull request #3 from tidymodels/less-imports
Browse files Browse the repository at this point in the history
Less imports
  • Loading branch information
EmilHvitfeldt authored Jun 22, 2024
2 parents 40bab52 + e24eef0 commit 23ac50a
Show file tree
Hide file tree
Showing 23 changed files with 73 additions and 28 deletions.
28 changes: 14 additions & 14 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ Version: 0.0.0.9000
Authors@R:
person("Emil", "Hvitfeldt", , "[email protected]", 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
2 changes: 1 addition & 1 deletion R/dt.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/inline.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#'
#' @returns a list of quosures.
#'
#' @examples
#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows"))
#' library(workflows)
#' library(recipes)
#' library(parsnip)
Expand Down
4 changes: 2 additions & 2 deletions R/json.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/mutate.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @returns A modified data frame.
#'
#' @examples
#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows"))
#' library(workflows)
#' library(recipes)
#' library(parsnip)
Expand Down
2 changes: 1 addition & 1 deletion R/orbital.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @returns A orbital object.
#'
#' @examples
#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows"))
#' library(workflows)
#' library(recipes)
#' library(parsnip)
Expand Down
2 changes: 1 addition & 1 deletion R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @returns A modified data frame.
#'
#' @examples
#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows"))
#' library(workflows)
#' library(recipes)
#' library(parsnip)
Expand Down
2 changes: 1 addition & 1 deletion R/sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/to.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#'
#' @returns A orbital object.
#'
#' @examples
#' @examplesIf rlang::is_installed(c("recipes", "tidypredict", "workflows"))
#' library(workflows)
#' library(recipes)
#' library(parsnip)
Expand Down
3 changes: 2 additions & 1 deletion man/orbital.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/orbital_dt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/orbital_inline.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/orbital_json_read.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/orbital_json_write.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/orbital_predict.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/orbital_sql.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/to_r_fun.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/testthat/test-dt.R
Original file line number Diff line number Diff line change
@@ -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())

Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-inline.R
Original file line number Diff line number Diff line change
@@ -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())

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-json.R
Original file line number Diff line number Diff line change
@@ -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())

Expand Down
18 changes: 18 additions & 0 deletions tests/testthat/test-orbital.R
Original file line number Diff line number Diff line change
@@ -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())

Expand All @@ -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() %>%
Expand All @@ -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() %>%
Expand All @@ -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())

Expand All @@ -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())

Expand All @@ -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())

Expand All @@ -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)
Expand All @@ -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(
Expand All @@ -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() %>%
Expand All @@ -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())

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-predict.R
Original file line number Diff line number Diff line change
@@ -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())

Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-sql.R
Original file line number Diff line number Diff line change
@@ -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())

Expand Down

0 comments on commit 23ac50a

Please sign in to comment.