Help us improve
Share bugs, ideas, or general feedback.
From analytics-toolkit
Use when the user wants to parallelize R code, speed up R scripts, or convert sequential loops/apply calls to parallel execution using the future framework
npx claudepluginhub halidaee/econtools_marketplace --plugin analytics-toolkitHow this skill is triggered — by the user, by Claude, or both
Slash command
/analytics-toolkit:r-parallelThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Converts sequential R code to parallel execution using the future ecosystem, with correct seed handling for reproducibility and cross-platform backends.
Use when code loads or uses mcptools (library(mcptools), mcptools::), connecting AI agents to R sessions via MCP, or exposing R as an MCP server for Claude Code or VS Code
Modern tidyverse patterns for R including pipes, joins, grouping, purrr, and stringr. Use when writing tidyverse R code.
Provides patterns for autonomous Claude Code loops from sequential pipelines and agentic REPLs to RFC-driven multi-agent DAGs. Use for continuous dev workflows, parallel agents, and CI/CD-style pipelines.
Share bugs, ideas, or general feedback.
Converts sequential R code to parallel execution using the future ecosystem, with correct seed handling for reproducibility and cross-platform backends.
NEVER:
set.seed() inside parallel workersplan(multicore) — not cross-platform (unreliable on macOS, unavailable on Windows)parallel, doParallel, or doSNOW — everything uses the future ecosystemMUST:
plan(multisession) as default backendlibrary() calls present for new packages.drafts/<filename>_sequential.R before any editsCAN:
progressr progress reporting for long tasksAsk user when:
set.seed() calls with unclear intentHand off to user when:
.drafts/ archive, commit the revert, and explain what was attemptedProceed when:
references/pitfalls.md.drafts/ subfolder if needed; copy original to .drafts/<filename>_sequential.R"Archive sequential version of <filename> before parallelizing"future.apply (base R), furrr (purrr), doFuture (foreach)references/future-patterns.mdreferences/seed-handling.mdplan(multisession) setup block at toplibrary() calls for new packagesprogressr progress reporting"Parallelize <filename>: <2-3 sentence summary of changes>"references/seed-handling.md §I"Verified <filename>: parallel outputs match sequential".drafts/ archive, git commit the revert, report what diverged, and hand off to the user| Signal in code | Category | Parallel replacement | Package |
|---|---|---|---|
for (i in ...) { results[[i]] <- ... } | Accumulating for-loop | future_lapply() | future.apply |
lapply(x, fun) | Base apply | future_lapply(x, fun) | future.apply |
sapply(x, fun) | Base apply | future_sapply(x, fun) | future.apply |
vapply(x, fun, type) | Base apply | future_vapply(x, fun, type) | future.apply |
mapply(fun, x, y) / Map(fun, x, y) | Base apply | future_mapply(fun, x, y) | future.apply |
tapply(x, index, fun) | Base apply | future_tapply(x, index, fun) | future.apply |
replicate(n, expr) | Replication | future_lapply(1:n, function(i) expr) | future.apply |
purrr::map(x, fun) | purrr | furrr::future_map(x, fun) | furrr |
purrr::map_dfr(x, fun) | purrr | furrr::future_map_dfr(x, fun) | furrr |
purrr::map2(x, y, fun) | purrr | furrr::future_map2(x, y, fun) | furrr |
purrr::pmap(list, fun) | purrr | furrr::future_pmap(list, fun) | furrr |
foreach(i=...) %do% {...} | foreach | foreach(i=...) %dofuture% {...} | doFuture |
| Nested loops → matrix/list | Nested loop | Flatten to single future_lapply() | future.apply |
plan(multisession) alwaysfuture.seed = TRUE / furrr_options(seed = TRUE) / .options.future = list(seed = TRUE)future.globals / future.packageslibrary(progressr); handlers(global = TRUE); with_progress({ ... })plan(sequential) at endavailableCores() to detect; plan(multisession, workers = N) to set.drafts/ subfolder, _sequential suffix, never alongside working files