inst/doc/sql.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup, message = FALSE---------------------------------------------------
library(dplyr)
library(dbplyr)

mf <- memdb_frame(x = 1, y = 2)

## -----------------------------------------------------------------------------
mf %>% 
  mutate(
    a = y * x, 
    b = a ^ 2,
  ) %>% 
  show_query()

## -----------------------------------------------------------------------------
mf %>% 
  mutate(z = foofify(x, y)) %>% 
  show_query()

mf %>% 
  filter(x %LIKE% "%foo%") %>% 
  show_query()

## -----------------------------------------------------------------------------
mf %>% 
  transmute(factorial = sql("x!")) %>% 
  show_query()

mf %>% 
  transmute(factorial = sql("CAST(x AS FLOAT)")) %>% 
  show_query()

Try the dbplyr package in your browser

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

dbplyr documentation built on Oct. 26, 2023, 9:06 a.m.