diff --git a/DESCRIPTION b/DESCRIPTION
index 0d3cad4..75f99ff 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,11 @@
Package: tidypredict
Title: Run Predictions Inside the Database
-Version: 0.4.8.9000
+Version: 0.4.9
Authors@R:
- person("Max", "Kuhn", , "max@rstudio.com", role = c("aut", "cre"))
+ c(
+ person("Max", "Kuhn", , "max@rstudio.com", role = c("aut", "cre")),
+ person("Edgar", "Ruiz", email = "edgar@rstudio.com", role = c("aut"))
+ )
Description: It parses a fitted 'R' model object, and returns a formula in
'Tidy Eval' code that calculates the predictions. It works with
several databases back-ends because it leverages 'dplyr' and 'dbplyr'
@@ -48,5 +51,5 @@ VignetteBuilder:
Config/Needs/website:
tidyverse/tidytemplate
Encoding: UTF-8
-RoxygenNote: 7.1.1.9000
+RoxygenNote: 7.2.0.9000
Config/testthat/edition: 3
diff --git a/NEWS.md b/NEWS.md
index 45b5532..2ce4d31 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# tidypredict (development version)
+# tidypredict 0.4.9
- Fixes issue handling GLM Binomial earth models (#97)
diff --git a/R/predict-column.R b/R/predict-column.R
index 865291a..c455f8d 100644
--- a/R/predict-column.R
+++ b/R/predict-column.R
@@ -17,7 +17,7 @@ tidypredict_to_column <- function(df, model, add_interval = FALSE,
interval = 0.95, vars = c("fit", "upper", "lower")) {
fit_model <- tidypredict_fit(model)
- if (class(fit_model) == "list") stop("tidypredict_to_column does not support tree based models")
+ if (inherits(fit_model, "list")) stop("tidypredict_to_column does not support tree based models")
fit <- vars[1]
upper <- vars[2]
diff --git a/R/to_sql.R b/R/to_sql.R
index b21bb55..6932f30 100644
--- a/R/to_sql.R
+++ b/R/to_sql.R
@@ -13,7 +13,7 @@
#' @export
tidypredict_sql <- function(model, con) {
f <- tidypredict_fit(model)
- if (class(f) == "call") {
+ if (inherits(f, "call")) {
dbplyr::translate_sql(!!f, con = con)
} else {
map(f, ~ dbplyr::translate_sql(!!.x, con = con))
@@ -37,7 +37,7 @@ tidypredict_sql <- function(model, con) {
#' @export
tidypredict_sql_interval <- function(model, con, interval = 0.95) {
f <- tidypredict_interval(model, interval)
- if (class(f) == "call") {
+ if (inherits(f, "call")) {
dbplyr::translate_sql(!!f, con = con)
} else {
map(f, ~ dbplyr::translate_sql(!!.x, con = con))
diff --git a/README.Rmd b/README.Rmd
index dd21200..d1dccf6 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -6,7 +6,7 @@ output: github_document
[![R-CMD-check](https://github.com/tidymodels/tidypredict/workflows/R-CMD-check/badge.svg)](https://github.com/tidymodels/tidypredict/actions)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/tidypredict)](https://CRAN.r-project.org/package=tidypredict)
-[![Codecov test coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://codecov.io/gh/tidymodels/tidypredict?branch=main)
+[![Codecov test coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/tidypredict?branch=main)
[![Downloads](http://cranlogs.r-pkg.org/badges/tidypredict)](https://CRAN.R-project.org/package=tidypredict)
```{r pre, include = FALSE}
@@ -120,11 +120,11 @@ tidy(pm)
This project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
-- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://rstd.io/tidymodels-community).
+- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/tidypredict/issues).
-- Either way, learn how to create and share a [reprex](https://rstd.io/reprex) (a minimal, reproducible example), to clearly communicate about your code.
+- Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example), to clearly communicate about your code.
- Check out further details on [contributing guidelines for tidymodels packages](https://www.tidymodels.org/contribute/) and [how to get help](https://www.tidymodels.org/help/).
diff --git a/README.md b/README.md
index 93bd656..48b47b9 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,9 @@
# tidypredict
[![R-CMD-check](https://github.com/tidymodels/tidypredict/workflows/R-CMD-check/badge.svg)](https://github.com/tidymodels/tidypredict/actions)
-[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/tidypredict)](https://CRAN.r-project.org/package=tidypredict)
+[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/tidypredict)](https://CRAN.r-project.org/package=tidypredict)
[![Codecov test
-coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://codecov.io/gh/tidymodels/tidypredict?branch=main)
+coverage](https://codecov.io/gh/tidymodels/tidypredict/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/tidypredict?branch=main)
[![Downloads](http://cranlogs.r-pkg.org/badges/tidypredict)](https://CRAN.R-project.org/package=tidypredict)
The main goal of `tidypredict` is to enable running predictions inside
@@ -49,7 +49,7 @@ number to grow much. The main focus at this time is to add more models
to support.
| Function | Description |
-| ---------------------------- | ------------------------------------------------------------------------------ |
+|------------------------------|--------------------------------------------------------------------------------|
| `tidypredict_fit()` | Returns an R formula that calculates the prediction |
| `tidypredict_sql()` | Returns a SQL query based on the formula from `tidypredict_fit()` |
| `tidypredict_to_column()` | Adds a new column using the formula from `tidypredict_fit()` |
@@ -94,26 +94,26 @@ formula adds the following capabilities:
The following models are supported by `tidypredict`:
- - Linear Regression - `lm()`
- - Generalized Linear model - `glm()`
- - Random Forest models - `randomForest::randomForest()`
- - Random Forest models, via `ranger` - `ranger::ranger()`
- - MARS models - `earth::earth()`
- - XGBoost models - `xgboost::xgb.Booster.complete()`
- - Cubist models - `Cubist::cubist()`
- - Tree models, via `partykit` - `partykit::ctree()`
+- Linear Regression - `lm()`
+- Generalized Linear model - `glm()`
+- Random Forest models - `randomForest::randomForest()`
+- Random Forest models, via `ranger` - `ranger::ranger()`
+- MARS models - `earth::earth()`
+- XGBoost models - `xgboost::xgb.Booster.complete()`
+- Cubist models - `Cubist::cubist()`
+- Tree models, via `partykit` - `partykit::ctree()`
### `parsnip`
`tidypredict` supports models fitted via the `parsnip` interface. The
ones confirmed currently work in `tidypredict` are:
- - `lm()` - `parsnip`: `linear_reg()` with *“lm”* as the engine.
- - `randomForest::randomForest()` - `parsnip`: `rand_forest()` with
+- `lm()` - `parsnip`: `linear_reg()` with *“lm”* as the engine.
+- `randomForest::randomForest()` - `parsnip`: `rand_forest()` with
*“randomForest”* as the engine.
- - `ranger::ranger()` - `parsnip`: `rand_forest()` with *“ranger”* as
+- `ranger::ranger()` - `parsnip`: `rand_forest()` with *“ranger”* as
the engine.
- - `earth::earth()` - `parsnip`: `mars()` with *“earth”* as the engine.
+- `earth::earth()` - `parsnip`: `mars()` with *“earth”* as the engine.
### `broom`
@@ -125,7 +125,7 @@ pm <- parse_model(lm(wt ~ ., mtcars))
tidy(pm)
```
- ## # A tibble: 11 x 2
+ ## # A tibble: 11 × 2
## term estimate
##
## 1 (Intercept) -0.231
@@ -146,17 +146,17 @@ This project is released with a [Contributor Code of
Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
- - For questions and discussions about tidymodels packages, modeling,
+- For questions and discussions about tidymodels packages, modeling,
and machine learning, please [post on RStudio
- Community](https://rstd.io/tidymodels-community).
+ Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).
- - If you think you have encountered a bug, please [submit an
+- If you think you have encountered a bug, please [submit an
issue](https://github.com/tidymodels/tidypredict/issues).
- - Either way, learn how to create and share a
- [reprex](https://rstd.io/reprex) (a minimal, reproducible example),
+- Either way, learn how to create and share a
+ [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example),
to clearly communicate about your code.
- - Check out further details on [contributing guidelines for tidymodels
+- Check out further details on [contributing guidelines for tidymodels
packages](https://www.tidymodels.org/contribute/) and [how to get
help](https://www.tidymodels.org/help/).
diff --git a/man/tidypredict-package.Rd b/man/tidypredict-package.Rd
index e0c41ee..a034618 100644
--- a/man/tidypredict-package.Rd
+++ b/man/tidypredict-package.Rd
@@ -6,14 +6,9 @@
\alias{tidypredict-package}
\title{tidypredict: Run Predictions Inside the Database}
\description{
-\if{html}{\figure{logo.png}{options: align='right' alt='logo' width='120'}}
+\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}}
-It parses a fitted 'R' model object, and returns a formula
- in 'Tidy Eval' code that calculates the predictions.
- It works with several databases back-ends because it leverages 'dplyr'
- and 'dbplyr' for the final 'SQL' translation of the algorithm. It currently
- supports lm(), glm(), randomForest(), ranger(), earth(), xgb.Booster.complete(),
- cubist(), and ctree() models.
+It parses a fitted 'R' model object, and returns a formula in 'Tidy Eval' code that calculates the predictions. It works with several databases back-ends because it leverages 'dplyr' and 'dbplyr' for the final 'SQL' translation of the algorithm. It currently supports lm(), glm(), randomForest(), ranger(), earth(), xgb.Booster.complete(), cubist(), and ctree() models.
}
\seealso{
Useful links:
diff --git a/tidypredict.Rproj b/tidypredict.Rproj
index 1788e68..dc78290 100644
--- a/tidypredict.Rproj
+++ b/tidypredict.Rproj
@@ -14,5 +14,6 @@ LaTeX: pdfLaTeX
BuildType: Package
PackageUseDevtools: Yes
+PackageCleanBeforeInstall: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette
diff --git a/vignettes/cubist.Rmd b/vignettes/cubist.Rmd
index 9416261..93a69a0 100644
--- a/vignettes/cubist.Rmd
+++ b/vignettes/cubist.Rmd
@@ -2,7 +2,7 @@
title: "Cubist models"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{cubist}
+ %\VignetteIndexEntry{Cubist models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/glm.Rmd b/vignettes/glm.Rmd
index fa6fbef..8543238 100644
--- a/vignettes/glm.Rmd
+++ b/vignettes/glm.Rmd
@@ -2,7 +2,7 @@
title: "Generalized Linear Regression"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{glm}
+ %\VignetteIndexEntry{Generalized Linear Regression}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/lm.Rmd b/vignettes/lm.Rmd
index e2dfd0f..c1ba8bf 100644
--- a/vignettes/lm.Rmd
+++ b/vignettes/lm.Rmd
@@ -2,7 +2,7 @@
title: "Linear Regression"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{lm}
+ %\VignetteIndexEntry{Linear Regression}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/mars.Rmd b/vignettes/mars.Rmd
index 61530bd..3deb779 100644
--- a/vignettes/mars.Rmd
+++ b/vignettes/mars.Rmd
@@ -2,7 +2,7 @@
title: "MARS models via the `earth` package"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{mars}
+ %\VignetteIndexEntry{MARS models via the `earth` package}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/non-r.Rmd b/vignettes/non-r.Rmd
index 11b8140..c67a594 100644
--- a/vignettes/non-r.Rmd
+++ b/vignettes/non-r.Rmd
@@ -2,7 +2,7 @@
title: "Non-R Models"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{non-r}
+ %\VignetteIndexEntry{Non-R Models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/ranger.Rmd b/vignettes/ranger.Rmd
index f3bb04b..c2b8745 100644
--- a/vignettes/ranger.Rmd
+++ b/vignettes/ranger.Rmd
@@ -2,7 +2,7 @@
title: "Random Forest, using Ranger"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{ranger}
+ %\VignetteIndexEntry{Random Forest, using Ranger}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/regression.Rmd b/vignettes/regression.Rmd
index e07a510..ae88b27 100644
--- a/vignettes/regression.Rmd
+++ b/vignettes/regression.Rmd
@@ -2,7 +2,7 @@
title: "Create a regression spec - version 2"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{regression}
+ %\VignetteIndexEntry{Create a regression spec - version 2}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/rf.Rmd b/vignettes/rf.Rmd
index 41f92d0..252577d 100644
--- a/vignettes/rf.Rmd
+++ b/vignettes/rf.Rmd
@@ -2,7 +2,7 @@
title: "Random Forest"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{rf}
+ %\VignetteIndexEntry{Random Forest}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/save.Rmd b/vignettes/save.Rmd
index dd067e7..54b4271 100644
--- a/vignettes/save.Rmd
+++ b/vignettes/save.Rmd
@@ -2,7 +2,7 @@
title: "Save and re-load models"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{save}
+ %\VignetteIndexEntry{Save and re-load models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/sql.Rmd b/vignettes/sql.Rmd
index f308788..22b9f85 100644
--- a/vignettes/sql.Rmd
+++ b/vignettes/sql.Rmd
@@ -2,7 +2,7 @@
title: "Database write-back"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{randomForest}
+ %\VignetteIndexEntry{Database write-back}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/tree.Rmd b/vignettes/tree.Rmd
index 8168ab3..3707713 100644
--- a/vignettes/tree.Rmd
+++ b/vignettes/tree.Rmd
@@ -2,7 +2,7 @@
title: "Create a tree spec - version 2"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{tree}
+ %\VignetteIndexEntry{Create a tree spec - version 2}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
diff --git a/vignettes/xgboost.Rmd b/vignettes/xgboost.Rmd
index 0a27f88..9ecc6c0 100644
--- a/vignettes/xgboost.Rmd
+++ b/vignettes/xgboost.Rmd
@@ -2,7 +2,7 @@
title: "XGBoost models"
output: rmarkdown::html_vignette
vignette: >
- %\VignetteIndexEntry{xgboost}
+ %\VignetteIndexEntry{XGBoost models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---