Description Usage Arguments Value Examples
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 powerful enough to implement "The Split-Apply-Combine Strategy for Data Analysis" https://www.jstatsoft.org/article/view/v040i01
1 2 3 4 5 6 7 8 9 10 |
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 |
list of data items
1 2 3 4 5 6 | d <- data.frame(group=c(1,1,2,2,2),
order=c(.1,.2,.3,.4,.5),
values=c(10,20,2,4,8))
dSplit <- replyr_split(d, 'group', partitionMethod='extract')
dApp <- lapply(dSplit, function(di) data.frame(as.list(colMeans(di))))
replyr_bind_rows(dApp)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.