--- title: "Getting started with misc::parfor" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Getting started with misc::parfor} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r} # Basic usage - single arguments misc::parfor(function(x) x^2, 1:10) # Parallel with 2 cores misc::parfor(function(x) x^2, 1:10, cl = 2) # Multiple arguments using do.call style args_list <- list(list(x=1, y=2), list(x=3, y=4), list(x=5, y=6)) misc::parfor(function(x, y) x + y, args_list, use_do_call = TRUE) # With additional fixed arguments misc::parfor(function(x, power) x^power, 1:5, power = 3) # With error handling misc::parfor(function(x) if(x==3) stop("error") else x^2, 1:5, errorhandling = "remove") ```