An open API service indexing awesome lists of open source software.

https://github.com/edwindj/ffbase2

dplyr for ff
https://github.com/edwindj/ffbase2

Last synced: about 1 year ago
JSON representation

dplyr for ff

Awesome Lists containing this project

README

          

ffbase2
=======

Next version of `ffbase`
- dplyr on ff

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

[![Build Status](https://travis-ci.org/edwindj/ffbase2.svg?branch=master)](https://travis-ci.org/edwindj/ffbase2)

## Install

`ffbase` is currently only available from github. To install it, run the following
script.
```S
# install.packages("devtools")
devtools::install_github("edwindj/ffbase2")
```

### CRAN-readiness

- Documentation needs to be completed
- Add more tests
- copy some `dplyr` internal functions into ffbase2
- Phase out dependency on `ffbase` (version 1)

## Usage
```{r, echo=FALSE}
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")`.

```S
iris_f <- tbl_ffdf(iris)

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

A `tbl_ffdf` is also a `ffdf`
```{r}
iris_f <- tbl_ffdf(iris)
is.ffdf(iris_f)
```

Use `src_ffdf` for storing your data in a directory
```{r}
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`
```{r}
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`
```{r}
src <- src_ffdf("./db_ff")
copy_to(src, iris) # or equivalenty tbl_ffdf(iris, src)
src_tbls(src)
```

```{r, echo=FALSE}
unlink("db_ff",recursive = T, force = T)
```