https://github.com/mrchypark/dbf
Provide Dummy DB Syntax in Namespace to use functions with dplyr
https://github.com/mrchypark/dbf
database dbi dplyr rstats syntax
Last synced: 2 months ago
JSON representation
Provide Dummy DB Syntax in Namespace to use functions with dplyr
- Host: GitHub
- URL: https://github.com/mrchypark/dbf
- Owner: mrchypark
- License: other
- Created: 2018-11-15T14:37:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T18:30:47.000Z (over 6 years ago)
- Last Synced: 2024-04-14T05:39:37.736Z (about 1 year ago)
- Topics: database, dbi, dplyr, rstats, syntax
- Language: R
- Homepage: https://mrchypark.github.io/DBF/
- Size: 24.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DBF
The goal of DBF is to provide dummy DB syntax in namespace to use functions with dplyr
## Installation
You can install the developed version of DBF from [github](https://github.com/mrchypark/DBF) with:
``` r
# if you don't instatll remotes package, uncomment & run below line.
# install.packages("remotes")
remotes::install_github("mrchypark/DBF")
```## Example
This is a basic example which shows you how to solve a common problem:
``` r
library(DBI)
library(DBF)conn <- dbConnect(
RPostgres::Postgres(),
host = HOST, # i.e. 'ec2-54-83-201-96.compute-1.amazonaws.com'
port = 5432, # or any other port specified by your DBA
user = 'postgres',
password = 'password'
)list_of_syntax <- get_function(conn)
set_function(list_of_syntax)
```
## Usage
``` r
library(dplyr)
library(DBI)
library(DBF)conn <- dbConnect(
RPostgres::Postgres(),
host = HOST, # i.e. 'ec2-54-83-201-96.compute-1.amazonaws.com'
port = 5432, # or any other port specified by your DBA
user = 'postgres',
password = 'password'
)copy_to(conn, test)
list_of_syntax <- get_function(conn)
set_function(list_of_syntax)tbl(conn, "test") %>%
mutate(date = DATE_TRUCN("day", date))```
## Special Thanks
[Tyler Morgan-Wall](https://twitter.com/tylermorganwall) @tylermorganwall [history](https://twitter.com/mrchypark_/status/1063113560086130688)