From 817ecadfc9c075db2127d2da64818d460b6c0f24 Mon Sep 17 00:00:00 2001 From: Vaclav Hausenblas Date: Mon, 21 Oct 2019 08:01:27 +0200 Subject: [PATCH 1/3] roxygenize after update in data.table --- man/dtq.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/dtq.Rd b/man/dtq.Rd index 246eb86..fa14c51 100644 --- a/man/dtq.Rd +++ b/man/dtq.Rd @@ -5,7 +5,7 @@ \title{data.table query - alias for data.table's \code{`[`} method} \usage{ dtq(x, i, j, by, keyby, with = TRUE, - nomatch = getOption("datatable.nomatch"), mult = "all", + nomatch = getOption("datatable.nomatch", NA), mult = "all", roll = FALSE, rollends = if (roll == "nearest") c(TRUE, TRUE) else if (roll >= 0) c(FALSE, TRUE) else c(TRUE, FALSE), which = FALSE, .SDcols, verbose = getOption("datatable.verbose"), From 181a6a101226467804db7b5bf444a1b716ca8035 Mon Sep 17 00:00:00 2001 From: Vaclav Hausenblas Date: Thu, 26 Mar 2020 11:30:39 +0100 Subject: [PATCH 2/3] Correct function name. --- README.Rmd | 6 +++--- README.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.Rmd b/README.Rmd index 181026a..cffc7f9 100644 --- a/README.Rmd +++ b/README.Rmd @@ -50,9 +50,9 @@ your_db <- dbConnect(RMariaDB::MariaDB(), group = "your-db") etl_read(from = my_db, name = "customers") %>% etl_write(to = your_csv) # extract -> transform -> load -etl_read(from = my_db, name = "orders") %>% # extract from a database - dbq(, order_year := year(order_date)) %>% # transform (adding a new column) - etl_write(to = your_db, name = "customers") # load +etl_read(from = my_db, name = "orders") %>% # db query: EXTRACT from a database + dtq(, order_year := year(order_date)) %>% # data.table query: TRANSFORM (adding a new column) + etl_write(to = your_db, name = "customers") # LOAD to a db ``` ### Other tools diff --git a/README.md b/README.md index a24bb22..b1e16ff 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ your_db <- dbConnect(RMariaDB::MariaDB(), group = "your-db") etl_read(from = my_db, name = "customers") %>% etl_write(to = your_csv) # extract -> transform -> load -etl_read(from = my_db, name = "orders") %>% # extract from a database - dbq(, order_year := year(order_date)) %>% # transform (adding a new column) - etl_write(to = your_db, name = "customers") # load +etl_read(from = my_db, name = "orders") %>% # db query: EXTRACT from a database + dtq(, order_year := year(order_date)) %>% # data.table query: TRANSFORM (adding a new column) + etl_write(to = your_db, name = "customers") # LOAD to a db ``` ### Other tools From 9ee95e60457915146b70e40c7cc8b679c9473b0f Mon Sep 17 00:00:00 2001 From: Vaclav Hausenblas Date: Fri, 22 May 2020 20:06:12 +0200 Subject: [PATCH 3/3] Update docs with roxigen --- DESCRIPTION | 2 +- man/add_diff_value.Rd | 6 ++++-- man/convert_cols.Rd | 3 +-- man/dtq.Rd | 22 +++++++++++++++----- man/etl_write.RODBC.Rd | 12 +++++++++-- man/etl_write.odbc32.Rd | 12 +++++++++-- man/pipe_table.Rd | 45 ++++++++++++++++++++++------------------- 7 files changed, 67 insertions(+), 35 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 287a0b4..8a0b770 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,7 +10,7 @@ Encoding: UTF-8 LazyData: true Imports: data.table -RoxygenNote: 6.1.1 +RoxygenNote: 7.1.0 Suggests: testthat, DBI, diff --git a/man/add_diff_value.Rd b/man/add_diff_value.Rd index 5341fa3..3bf3aaa 100644 --- a/man/add_diff_value.Rd +++ b/man/add_diff_value.Rd @@ -4,8 +4,7 @@ \alias{add_diff_value} \title{Add a new column as a differenced value of existing column} \usage{ -add_diff_value(.data, value_var = NULL, by_vars = NULL, - postfix = "_diff") +add_diff_value(.data, value_var = NULL, by_vars = NULL, postfix = "_diff") } \arguments{ \item{.data}{input data.table} @@ -15,6 +14,9 @@ add_diff_value(.data, value_var = NULL, by_vars = NULL, \item{by_vars}{character; vector of dimensions for 'group by'} \item{postfix}{character; posfix is added at the end of the name of the new column} +} +\value{ + } \description{ Add a new column as a differenced value of existing column diff --git a/man/convert_cols.Rd b/man/convert_cols.Rd index 9c5bf12..fe2b944 100644 --- a/man/convert_cols.Rd +++ b/man/convert_cols.Rd @@ -7,8 +7,7 @@ \usage{ convert_cols(x, ...) -\method{convert_cols}{data.table}(x, from_class, to_class, - inplace = TRUE) +\method{convert_cols}{data.table}(x, from_class, to_class, inplace = TRUE) } \arguments{ \item{x}{an input data.table} diff --git a/man/dtq.Rd b/man/dtq.Rd index fa14c51..de19c64 100644 --- a/man/dtq.Rd +++ b/man/dtq.Rd @@ -4,13 +4,25 @@ \alias{dtq} \title{data.table query - alias for data.table's \code{`[`} method} \usage{ -dtq(x, i, j, by, keyby, with = TRUE, - nomatch = getOption("datatable.nomatch", NA), mult = "all", - roll = FALSE, rollends = if (roll == "nearest") c(TRUE, TRUE) else if - (roll >= 0) c(FALSE, TRUE) else c(TRUE, FALSE), which = FALSE, .SDcols, +dtq( + x, + i, + j, + by, + keyby, + with = TRUE, + nomatch = getOption("datatable.nomatch", NA), + mult = "all", + roll = FALSE, + rollends = if (roll == "nearest") c(TRUE, TRUE) else if (roll >= 0) c(FALSE, TRUE) + else c(TRUE, FALSE), + which = FALSE, + .SDcols, verbose = getOption("datatable.verbose"), allow.cartesian = getOption("datatable.allow.cartesian"), - drop = NULL, on = NULL) + drop = NULL, + on = NULL +) } \description{ data.table query - alias for data.table's \code{`[`} method diff --git a/man/etl_write.RODBC.Rd b/man/etl_write.RODBC.Rd index 67fc593..ea10654 100644 --- a/man/etl_write.RODBC.Rd +++ b/man/etl_write.RODBC.Rd @@ -4,8 +4,16 @@ \alias{etl_write.RODBC} \title{Write tables via RODBC connection} \usage{ -\method{etl_write}{RODBC}(to, x, name, schema = NULL, rownames = FALSE, - safer = FALSE, varTypes = NULL, ...) +\method{etl_write}{RODBC}( + to, + x, + name, + schema = NULL, + rownames = FALSE, + safer = FALSE, + varTypes = NULL, + ... +) } \arguments{ \item{to}{} diff --git a/man/etl_write.odbc32.Rd b/man/etl_write.odbc32.Rd index b246d19..a18e3a5 100644 --- a/man/etl_write.odbc32.Rd +++ b/man/etl_write.odbc32.Rd @@ -4,8 +4,16 @@ \alias{etl_write.odbc32} \title{Write tables via odbc32 connection} \usage{ -\method{etl_write}{odbc32}(to, x, name, schema = NULL, - rownames = FALSE, safer = FALSE, varTypes = NULL, ...) +\method{etl_write}{odbc32}( + to, + x, + name, + schema = NULL, + rownames = FALSE, + safer = FALSE, + varTypes = NULL, + ... +) } \arguments{ \item{to}{} diff --git a/man/pipe_table.Rd b/man/pipe_table.Rd index 00b65ed..703cd8a 100644 --- a/man/pipe_table.Rd +++ b/man/pipe_table.Rd @@ -6,23 +6,38 @@ \alias{etl_pipe} \title{complete ETL pipe in a single function} \usage{ -pipe_table(name, from, to, name_target = NULL, transform = NULL, - from_schema = NULL, to_schema = NULL, read_args = list(), - write_args = list(overwrite = TRUE), asDT = TRUE, - lowercase = FALSE) +pipe_table( + name, + from, + to, + name_target = NULL, + transform = NULL, + from_schema = NULL, + to_schema = NULL, + read_args = list(), + write_args = list(overwrite = TRUE), + asDT = TRUE, + lowercase = FALSE +) pipe_tables(tables, ...) -etl_pipe(from, to, transform = NULL, read_args = list(), - write_args = list(overwrite = TRUE), asDT = TRUE, - lowercase = FALSE) +etl_pipe( + from, + to, + transform = NULL, + read_args = list(), + write_args = list(overwrite = TRUE), + asDT = TRUE, + lowercase = FALSE +) } \arguments{ \item{name}{name of the table} -\item{from}{DBI/R environment/file name} +\item{from}{DBI/R environment/file name/...} -\item{to}{DBI/R environment/file name} +\item{to}{DBI/R environment/file name/...} \item{name_target}{optional parameter specifying new name of the table at the target} @@ -43,18 +58,6 @@ etl_pipe(from, to, transform = NULL, read_args = list(), \item{tables}{vector of table names} \item{...}{args passed to `pipe_table()`} - -\item{from}{DBI/R environment/file name/...} - -\item{to}{DBI/R environment/file name/...} - -\item{transform}{transformation function} - -\item{read_args}{list of arguments passed to read/extract function} - -\item{write_args}{list of arguments passed to write/load function} - -\item{asDT}{logical; convert the data.frame to data.table during the etl?} } \description{ complete ETL pipe in a single function