ffbase2

Next version of ffbase - dplyr on ff

Working, but documentation is not yet CRAN ready...

Build Status

Install

ffbase is currently only available from github. To install it, run the following script.

# install.packages("devtools")
devtools::install_github("edwindj/ffbase2")

CRAN-readiness

Usage

library(ffbase2)
unlink("db_ff", recursive = T, force = T)

Creating a tbl_ffdf: this will create/use a temporary ffdf data.frame in options("fftempdir").

iris_f <- tbl_ffdf(iris)

species <- 
   iris_f %>%
   group_by(Species) %>%
   summarise(petal_width = sum(Petal.Width))

A tbl_ffdf is also a ffdf

iris_f <- tbl_ffdf(iris)
is.ffdf(iris_f)

Use src_ffdf for storing your data in a directory

library(ffbase2)
# store a ffdf data.frame in "./db_ff"" directory
cars <- tbl_ffdf(mtcars, src="./db_ff", name="cars")
print(cars, n=2)

To retrieve tables from a ffdf source, use src_ffdf

src <- src_ffdf("./db_ff")
print(src) 

# what tables are available?
src_tbls(src)

#retrieve table from src 
cars <- tbl(src, from="cars") # or equivalently tbl_ffdf(src=src, name="cars")
print(cars, n=2)

Use copy_to to add data to a src_ffdf

src <- src_ffdf("./db_ff")
copy_to(src, iris) # or equivalenty tbl_ffdf(iris, src)
src_tbls(src)
unlink("db_ff",recursive = T, force = T)


edwindj/ffbase2 documentation built on May 15, 2019, 11:05 p.m.