distribute: Calculations for how to distribute x items over N nodes

Description Usage Arguments Value See Also Examples

View source: R/util.R

Description

This function is used to determine how to distribute the contents of a data frame across the cluster. It may either be called with a single number representing the total number of rows, or it may be called with a vector of numbers representing the size of groups.

Usage

1
distribute(x, N)

Arguments

x

Number of items or a vector of group sizes

N

Number of nodes

Value

A vector containing number of rows or a list containing the indices of groups

See Also

Other utility functions: between, cumall, cumany, cummean, first, lag, last, lead, n_distinct, n_groups, nth, n

Examples

1
2
distribute (100, 4)
distribute (c(25, 25, 50), 2)

Example output

Loading required package: magrittr

Attaching package: 'multiplyr'

The following objects are masked from 'package:stats':

    filter, lag

[1] 25 25 25 25
[[1]]
[1] 3

[[2]]
[1] 1 2

multiplyr documentation built on May 30, 2017, 12:09 a.m.