apply_combinations_parallel: Apply a function to every combination of some sequences...

Description Usage Arguments Details Value

View source: R/demonanalysis.R

Description

Apply a function to every combination of some sequences (parallelized version)

Usage

1
apply_combinations_parallel(n_cores, vec, fn, ...)

Arguments

n_cores

number of cores

vec

vector of final values of the sequences (initial values are always zero)

fn

function to apply to the values

...

other arguments passed to fn

Details

Adding the argument type="FORK" to makeCluster solves the problem of variables and function scope (this option means that the function automatically knows all environment variables) !!!! Notice that this only works on mac and linux, else we would need to use clusterExport and clusterEvalQ something like: clusterExport(cl, list("all_output", "combine_dfs", "get_population_df", "fread")) !!!! to test if needed!!!!

Value

result of applying fn to every combination of vec values


robjohnnoble/demonanalysis documentation built on June 30, 2020, 12:47 a.m.