asDate {CDMConnector} | R Documentation |
as.Date dbplyr translation wrapper
Description
This is a workaround for using as.Date inside dplyr verbs against a database
backend. This function should only be used inside dplyr verbs where the first
argument is a database table reference. asDate
must be unquoted with !! inside
dplyr verbs (see example).
Usage
asDate(x)
as_date(x)
Arguments
x |
an R expression |
Examples
## Not run:
con <- DBI::dbConnect(odbc::odbc(), "Oracle")
date_tbl <- dplyr::copy_to(con,
data.frame(y = 2000L, m = 10L, d = 10L),
name = "tmp",
temporary = TRUE)
df <- date_tbl %>%
dplyr::mutate(date_from_parts = !!asDate(paste0(
.data$y, "/",
.data$m, "/",
.data$d
))) %>%
dplyr::collect()
## End(Not run)
[Package CDMConnector version 1.5.0 Index]