Skip to content

Commit 546219b

Browse files
committed
Update README
1 parent d0e87eb commit 546219b

File tree

2 files changed

+70
-27
lines changed

2 files changed

+70
-27
lines changed

README.Rmd

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ library(modeldb)
1414
[![Codecov test coverage](https://codecov.io/gh/tidymodels/modeldb/branch/master/graph/badge.svg)](https://codecov.io/gh/tidymodels/modeldb?branch=master)
1515
[![Downloads](http://cranlogs.r-pkg.org/badges/modeldb)](http://cran.rstudio.com/package=modeldb)
1616

17-
Fit models inside the database. **`modeldb` works with most databases back-ends** because it leverages `dplyr` and `dbplyr` for the final SQL translation of the algorithm. It currently supports:
17+
Fit models inside the database! **modeldb works with most database back-ends** because it leverages [dplyr](https://dplyr.tidyverse.org/) and [dbplyr](https://dbplyr.tidyverse.org/) for the final SQL translation of the algorithm. It currently supports:
1818

1919
- K-means clustering
2020

@@ -23,19 +23,21 @@ Fit models inside the database. **`modeldb` works with most databases back-ends*
2323
## Installation
2424

2525
Install the CRAN version with:
26+
2627
```{r, eval = FALSE}
27-
# install.packages("modeldb")
28+
install.packages("modeldb")
2829
```
2930

30-
The development version is available using `devtools` as follows:
31+
The development version is available from GitHub using remotes:
32+
3133
```{r, eval = FALSE}
3234
# install.packages("remotes")
33-
# remotes::install_github("tidymodels/modeldb")
35+
remotes::install_github("tidymodels/modeldb")
3436
```
3537

3638
## Linear regression
3739

38-
An easy way to try out the package is by creating a temporary SQLite database, and loading `mtcars` to it
40+
An easy way to try out the package is by creating a temporary SQLite database, and loading `mtcars` to it.
3941

4042
```{r}
4143
con <- DBI::dbConnect(RSQLite::SQLite(), path = ":memory:")
@@ -51,7 +53,7 @@ tbl(con, "mtcars") %>%
5153
linear_regression_db(wt)
5254
```
5355

54-
The model output can be parsed by `tidypredict` to run the predictions in the database. Please see the `Linear Regression` article to learn more about how to use `linear_regression_db()`
56+
The model output can be parsed by [tidypredict](https://tidypredict.tidymodels.org/) to run the predictions in the database. Please see the "Linear Regression" article to learn more about how to use `linear_regression_db()`
5557

5658
## K Means clustering
5759

@@ -67,8 +69,21 @@ km <- tbl(con, "mtcars") %>%
6769
colnames(km)
6870
```
6971

70-
The SQL statement from `tbl` can be extracted using `dbplyr`'s `remote_query()`
72+
The SQL statement from `tbl` can be extracted using dbplyr's `remote_query()`
7173

7274
```{r}
7375
dbplyr::remote_query(km)
7476
```
77+
78+
## Contributing
79+
80+
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.
81+
82+
- For questions and discussions about tidymodels packages, modeling, and machine learning, [join us on RStudio Community](https://rstd.io/tidymodels-community).
83+
84+
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/modeldb/issues).
85+
86+
- Either way, learn how to create and share a [reprex](https://rstd.io/reprex) (a minimal, reproducible example), to clearly communicate about your code. Check out [this helpful article on how to create reprexes](https://dbplyr.tidyverse.org/articles/reprex.html) for problems involving a database.
87+
88+
- 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/).
89+

README.md

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ status](https://github.com/tidymodels/modeldb/workflows/R-CMD-check/badge.svg)](
88
coverage](https://codecov.io/gh/tidymodels/modeldb/branch/master/graph/badge.svg)](https://codecov.io/gh/tidymodels/modeldb?branch=master)
99
[![Downloads](http://cranlogs.r-pkg.org/badges/modeldb)](http://cran.rstudio.com/package=modeldb)
1010

11-
Fit models inside the database. **`modeldb` works with most databases
12-
back-ends** because it leverages `dplyr` and `dbplyr` for the final SQL
11+
Fit models inside the database\! **modeldb works with most database
12+
back-ends** because it leverages [dplyr](https://dplyr.tidyverse.org/)
13+
and [dbplyr](https://dbplyr.tidyverse.org/) for the final SQL
1314
translation of the algorithm. It currently supports:
1415

1516
- K-means clustering
@@ -21,20 +22,20 @@ translation of the algorithm. It currently supports:
2122
Install the CRAN version with:
2223

2324
``` r
24-
# install.packages("modeldb")
25+
install.packages("modeldb")
2526
```
2627

27-
The development version is available using `devtools` as follows:
28+
The development version is available from GitHub using remotes:
2829

2930
``` r
3031
# install.packages("remotes")
31-
# remotes::install_github("tidymodels/modeldb")
32+
remotes::install_github("tidymodels/modeldb")
3233
```
3334

3435
## Linear regression
3536

3637
An easy way to try out the package is by creating a temporary SQLite
37-
database, and loading `mtcars` to it
38+
database, and loading `mtcars` to it.
3839

3940
``` r
4041
con <- DBI::dbConnect(RSQLite::SQLite(), path = ":memory:")
@@ -55,9 +56,10 @@ tbl(con, "mtcars") %>%
5556
## <dbl> <dbl> <dbl>
5657
## 1 4.12 -0.156 0.125
5758

58-
The model output can be parsed by `tidypredict` to run the predictions
59-
in the database. Please see the `Linear Regression` article to learn
60-
more about how to use `linear_regression_db()`
59+
The model output can be parsed by
60+
[tidypredict](https://tidypredict.tidymodels.org/) to run the
61+
predictions in the database. Please see the “Linear Regression” article
62+
to learn more about how to use `linear_regression_db()`
6163

6264
## K Means clustering
6365

@@ -81,34 +83,60 @@ colnames(km)
8183
## [7] "hp" "drat" "wt" "qsec" "vs" "am"
8284
## [13] "gear" "carb"
8385

84-
The SQL statement from `tbl` can be extracted using `dbplyr`’s
86+
The SQL statement from `tbl` can be extracted using dbplyr’s
8587
`remote_query()`
8688

8789
``` r
8890
dbplyr::remote_query(km)
8991
```
9092

91-
## <SQL> SELECT `RHS`.`center` AS `k_center`, `LHS`.`k_mpg` AS `k_mpg`, `LHS`.`k_wt` AS `k_wt`, `RHS`.`mpg` AS `mpg`, `RHS`.`cyl` AS `cyl`, `RHS`.`disp` AS `disp`, `RHS`.`hp` AS `hp`, `RHS`.`drat` AS `drat`, `RHS`.`wt` AS `wt`, `RHS`.`qsec` AS `qsec`, `RHS`.`vs` AS `vs`, `RHS`.`am` AS `am`, `RHS`.`gear` AS `gear`, `RHS`.`carb` AS `carb`
92-
## FROM (SELECT `center` AS `k_center`, `mpg` AS `k_mpg`, `wt` AS `k_wt`
93-
## FROM (SELECT `center`, AVG(`mpg`) AS `mpg`, AVG(`wt`) AS `wt`
94-
## FROM (SELECT `mpg`, `wt`, `center`
95-
## FROM (SELECT *
93+
## <SQL> SELECT `k_center`, `k_mpg`, `k_wt`, `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`
94+
## FROM (SELECT `LHS`.`mpg` AS `mpg`, `LHS`.`cyl` AS `cyl`, `LHS`.`disp` AS `disp`, `LHS`.`hp` AS `hp`, `LHS`.`drat` AS `drat`, `LHS`.`wt` AS `wt`, `LHS`.`qsec` AS `qsec`, `LHS`.`vs` AS `vs`, `LHS`.`am` AS `am`, `LHS`.`gear` AS `gear`, `LHS`.`carb` AS `carb`, `LHS`.`k_center` AS `k_center`, `RHS`.`k_mpg` AS `k_mpg`, `RHS`.`k_wt` AS `k_wt`
95+
## FROM (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, `center` AS `k_center`
9696
## FROM (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, `center_1`, `center_2`, `center_3`, CASE
9797
## WHEN (`center_1` >= `center_1` AND `center_1` < `center_2` AND `center_1` < `center_3`) THEN ('center_1')
9898
## WHEN (`center_2` < `center_1` AND `center_2` >= `center_2` AND `center_2` < `center_3`) THEN ('center_2')
9999
## WHEN (`center_3` < `center_1` AND `center_3` < `center_2` AND `center_3` >= `center_3`) THEN ('center_3')
100100
## END AS `center`
101101
## FROM (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, SQRT(((20.6428571428571 - `mpg`) * (20.6428571428571 - `mpg`)) + ((3.07214285714286 - `wt`) * (3.07214285714286 - `wt`))) AS `center_1`, SQRT(((14.4583333333333 - `mpg`) * (14.4583333333333 - `mpg`)) + ((4.05866666666667 - `wt`) * (4.05866666666667 - `wt`))) AS `center_2`, SQRT(((30.0666666666667 - `mpg`) * (30.0666666666667 - `mpg`)) + ((1.873 - `wt`) * (1.873 - `wt`))) AS `center_3`
102102
## FROM `mtcars`))
103-
## WHERE (NOT(((`center`) IS NULL)))))
104-
## GROUP BY `center`)) AS `LHS`
105-
## RIGHT JOIN (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, `center`
103+
## WHERE (NOT(((`center`) IS NULL)))) AS `LHS`
104+
## LEFT JOIN (SELECT `center` AS `k_center`, `mpg` AS `k_mpg`, `wt` AS `k_wt`
105+
## FROM (SELECT `center`, AVG(`mpg`) AS `mpg`, AVG(`wt`) AS `wt`
106+
## FROM (SELECT `mpg`, `wt`, `center`
107+
## FROM (SELECT *
106108
## FROM (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, `center_1`, `center_2`, `center_3`, CASE
107109
## WHEN (`center_1` >= `center_1` AND `center_1` < `center_2` AND `center_1` < `center_3`) THEN ('center_1')
108110
## WHEN (`center_2` < `center_1` AND `center_2` >= `center_2` AND `center_2` < `center_3`) THEN ('center_2')
109111
## WHEN (`center_3` < `center_1` AND `center_3` < `center_2` AND `center_3` >= `center_3`) THEN ('center_3')
110112
## END AS `center`
111113
## FROM (SELECT `mpg`, `cyl`, `disp`, `hp`, `drat`, `wt`, `qsec`, `vs`, `am`, `gear`, `carb`, SQRT(((20.6428571428571 - `mpg`) * (20.6428571428571 - `mpg`)) + ((3.07214285714286 - `wt`) * (3.07214285714286 - `wt`))) AS `center_1`, SQRT(((14.4583333333333 - `mpg`) * (14.4583333333333 - `mpg`)) + ((4.05866666666667 - `wt`) * (4.05866666666667 - `wt`))) AS `center_2`, SQRT(((30.0666666666667 - `mpg`) * (30.0666666666667 - `mpg`)) + ((1.873 - `wt`) * (1.873 - `wt`))) AS `center_3`
112114
## FROM `mtcars`))
113-
## WHERE (NOT(((`center`) IS NULL)))) AS `RHS`
114-
## ON (`LHS`.`k_center` = `RHS`.`center`)
115+
## WHERE (NOT(((`center`) IS NULL)))))
116+
## GROUP BY `center`)) AS `RHS`
117+
## ON (`LHS`.`k_center` = `RHS`.`k_center`)
118+
## )
119+
120+
## Contributing
121+
122+
This project is released with a [Contributor Code of
123+
Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
124+
By contributing to this project, you agree to abide by its terms.
125+
126+
- For questions and discussions about tidymodels packages, modeling,
127+
and machine learning, [join us on RStudio
128+
Community](https://rstd.io/tidymodels-community).
129+
130+
- If you think you have encountered a bug, please [submit an
131+
issue](https://github.com/tidymodels/modeldb/issues).
132+
133+
- Either way, learn how to create and share a
134+
[reprex](https://rstd.io/reprex) (a minimal, reproducible example),
135+
to clearly communicate about your code. Check out [this helpful
136+
article on how to create
137+
reprexes](https://dbplyr.tidyverse.org/articles/reprex.html) for
138+
problems involving a database.
139+
140+
- Check out further details on [contributing guidelines for tidymodels
141+
packages](https://www.tidymodels.org/contribute/) and [how to get
142+
help](https://www.tidymodels.org/help/).

0 commit comments

Comments
 (0)