inst/doc/using_etl.R

## ----warning=FALSE------------------------------------------------------------
library(etl)
cars <- etl("mtcars")
class(cars)

## ----eval=FALSE---------------------------------------------------------------
#  # For PostgreSQL
#  library(RPostgreSQL)
#  db <- src_postgres(dbname = "mtcars", user = "postgres", host = "localhost")
#  
#  # Alternatively, for MySQL
#  library(RMySQL)
#  db <- src_mysql(dbname = "mtcars", user = "r-user", password = "mypass", host = "localhost")
#  cars <- etl("mtcars", db)

## -----------------------------------------------------------------------------
cars %>%
  etl_extract()

## -----------------------------------------------------------------------------
cars %>%
  etl_transform()

## -----------------------------------------------------------------------------
cars %>%
  etl_load()

## ----eval=FALSE---------------------------------------------------------------
#  cars %>%
#    etl_create()

## ----eval=FALSE---------------------------------------------------------------
#  cars %>%
#    etl_update()

## -----------------------------------------------------------------------------
getS3method("etl_update", "default")

## -----------------------------------------------------------------------------
getS3method("etl_create", "default")

## -----------------------------------------------------------------------------
cars %>%
  tbl("mtcars") %>%
  group_by(cyl) %>%
  summarise(N = n(), mean_mpg = mean(mpg))

## ----eval=FALSE---------------------------------------------------------------
#  etl_extract.etl_pkgname()

## ----eval=FALSE---------------------------------------------------------------
#  etl_transform.etl_pkgname()
#  etl_load.etl_pkgname()

## -----------------------------------------------------------------------------
tools::dependsOnPkgs("etl")

Try the etl package in your browser

Any scripts or data that you put into this service are public.

etl documentation built on Oct. 13, 2023, 1:08 a.m.