Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Jun 8, 2018
1 parent f182a81 commit b98cd3e
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 6 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
^README-.*\.png$
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
10 changes: 7 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Authors@R: c(person("Carl", "Boettiger",
person("Richard", "FitzJohn", role = "ctb"))
URL: https://github.com/cboettig/arkdb
BugReports: https://github.com/cboettig/arkdb/issues
License: MIT
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
ByteCompile: true
Expand All @@ -25,6 +25,10 @@ Imports:
DBI,
readr,
RSQLite,
progress
progress,
dplyr,
methods
Suggests:
nycflights13
nycflights13,
testthat,
knitr
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2018
COPYRIGHT HOLDER: Carl Boettiger
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2018 Carl Boettiger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ importFrom(dplyr,row_number)
importFrom(dplyr,sql)
importFrom(dplyr,summarise)
importFrom(dplyr,tbl)
importFrom(methods,is)
importFrom(progress,progress_bar)
importFrom(readr,read_tsv)
1 change: 1 addition & 0 deletions R/ark.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#'
#' @importFrom dbplyr src_dbi
#' @importFrom DBI dbListTables
#' @importFrom methods is
#' @export
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/unark.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ unark <- function(files, lines = 10000L, drv = RSQLite::SQLite(), ...){
#' Unarchive a single tsv file into an existing database
#'
#' @param filename a *.tsv.bz2 file to uncompress
#' @param db a database src (`src_dbi` object from `dplyr`)
#' @param db_con a database src (`src_dbi` object from `dplyr`)
#' @param lines number of lines to read in a chunk.
#'
#' @return the database connection (`src_dbi`, invisibly)
Expand Down
4 changes: 2 additions & 2 deletions man/unark_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(testthat)
library(arkdb)

test_check("arkdb")
51 changes: 51 additions & 0 deletions tests/testthat/test-arkdb.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## ---- echo = FALSE-------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)

## ----gh-installation, eval = FALSE---------------------------------------
#> # install.packages("devtools")
#> devtools::install_github("cboettig/arkdb")

## ------------------------------------------------------------------------
library(arkdb)

# additional libraries just for this demo
library(dbplyr)
library(dplyr)
library(nycflights13)
library(fs)

## ----example-------------------------------------------------------------
db <- dbplyr::nycflights13_sqlite(".")

## ------------------------------------------------------------------------
dir <- fs::dir_create("nycflights")
ark(db, dir)


## ------------------------------------------------------------------------
fs::dir_info(dir) %>% select(path, size)
fs::file_info("nycflights13.sqlite") %>% select(path, size)


## ------------------------------------------------------------------------
files <- fs::dir_ls(dir, glob = "*.tsv.bz2")

## ------------------------------------------------------------------------
new_db <- unark(files, dbname = "local.sqlite")

## ------------------------------------------------------------------------
tbl(new_db, "flights")

## ----include=FALSE-------------------------------------------------------
unlink("nycflights", TRUE)
unlink("local.sqlite")
unlink("nycflights13.sqlite")

## dbplyr handles this automatically
#DBI::dbDisconnect(db[[1]])
#DBI::dbDisconnect(new_db[[1]])

0 comments on commit b98cd3e

Please sign in to comment.