divide: Divide an object into roughly equally sized parts.

divideR Documentation

Divide an object into roughly equally sized parts.

Description

This is a helper to prepare lapply/mclapply operations on vectors, or matrices.

Usage

divide(.Object, n)

## S4 method for signature 'matrix'
divide(.Object, n)

## S4 method for signature 'vector'
divide(.Object, n)

Arguments

.Object

object to split up

n

number of objects

Value

a list of objects of the same class as the input object

See Also

split_into in the text2vec package offers a similar, and faster function for vectors

Examples

divide(1:10, n = 3)
M <- matrix(1:20, ncol = 2, byrow = TRUE)
divide(M, n = 3)
divide(M, n = 4)

PolMine/polmineR.misc documentation built on Nov. 23, 2022, 9:01 p.m.