batch_vec: Split vector into batches

View source: R/batch_vec.R

batch_vecR Documentation

Split vector into batches

Description

Split a vector into batches, each no longer than batch_size and creating at least n_cores batches, for use in parallel calculations.

Usage

batch_vec(vec, batch_size = NULL, n_cores = 1)

Arguments

vec

A vector to be split into batches

batch_size

Maximum size for each batch

n_cores

Number of compute cores, to be used as a minimum number of batches.

Value

A list of vectors, each no longer than batch_size, and with at least n_cores componenets.

See Also

batch_cols()

Examples

vec_split <- batch_vec(1:304, 50, 8)
vec_split2 <- batch_vec(1:304, 50)

rqtl/qtl2 documentation built on March 20, 2024, 6:35 p.m.