50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

replyr (version 0.2.0)

replyr_split: split a data item by values in a column.

Description

Partitions from by values in grouping column, and returns list. Only advised for a moderate number of groups and better if grouping column is an index. This plus lapply and replyr::bind_rows is powerfull enough to implement "The Split-Apply-Combine Strategy for Data Analysis" https://www.jstatsoft.org/article/view/v040i01

Usage

replyr_split(df, gcolumn, ..., ocolumn = NULL, decreasing = FALSE, partitionMethod = "extract", maxgroups = 100, eagerCompute = FALSE)

Arguments

df
remote dplyr data item
gcolumn
grouping column
...
force later values to be bound by name
ocolumn
ordering column (optional)
decreasing
if TRUE sort in decreasing order by ocolumn
partitionMethod
method to partition the data, one of 'split' (only works over local data frames), or 'extract'
maxgroups
maximum number of groups to work over
eagerCompute
if TRUE call compute on split results

Value

list of data items

Examples

Run this code

library('dplyr')
d <- data.frame(group=c(1,1,2,2,2),
                order=c(.1,.2,.3,.4,.5),
                values=c(10,20,2,4,8))
d %>% replyr_split('group')

Run the code above in your browser using DataLab