loop_ind_f: Prepares parallel loop indices.

View source: R/00_helpers.R

loop_ind_fR Documentation

Prepares parallel loop indices.

Description

loop_ind_f is a helper function that splits a vector of loop indices into a list of multiple loop indices for use in parallel processes within the flowGraph package.

Usage

loop_ind_f(x, n)

Arguments

x

A vector of loop indices.

n

An integer, or the number of vectors to split x into.

Value

list of n vectors with elements from x.

Examples


 old_loop_inds <- 1:10
 no_cores <- 5

 new_loop_inds <- flowGraph:::loop_ind_f(old_loop_inds, no_cores)
 # future::plan(future::multisession)
 # example_indices <- furrr::future_map(new_loop_inds, function(ii) {
 #     purrr::map(ii, function(i) i )
 # s})


aya49/flowGraph documentation built on Feb. 4, 2024, 6:40 p.m.