splitIndices
Split a Sequence of Integer Indices

Description

Divides a sequence of integers into contiguous pieces for distribution among the nodes of a cluster.

Usage

splitIndices(nx, ncl)

Arguments

nx an integer value. The number of elements to be divided.
ncl an integer value. The number of nodes in the cluster.

Details

splitIndices splits the sequence of integers from 1 to nx into contiguous pieces for each of ncl cluster nodes. The lengths of these pieces are roughly equal. The results are used by clusterSplit to assign elements of a list to the different elements of a cluster.
Value
returns a list of length ncl where each component contains a contiguous vector of integers between 1 and nx.
Differences between Spotfire Enterprise Runtime for R and Open-source R
splitIndices gives incorrect results in open-source R if nx or ncl is less than or equal to one. Spotfire Enterprise Runtime for R handles these cases better, returning a list with ncl elements.
See Also
split, cut, clusterSplit.
Examples
splitIndices(1, 3)
## [[1]]
## integer(0)
## 
## [[2]]
## [1] 1
## 
## [[3]]
## integer(0)

splitIndices(10, 4) ## [[1]] ## [1] 1 2 3 ## ## [[2]] ## [1] 4 5 ## ## [[3]] ## [1] 6 7 ## ## [[4]] ## [1] 8 9 10

## Not run: splitIndices(-10, 4) # gives error, since nx is less than zero ## End(Not run)

Package parallel version 6.1.1-7
Package Index