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-toolkitThis skill uses the workspace's default tool permissions.
Converts sequential R code to parallel execution using the future ecosystem, with correct seed handling for reproducibility and cross-platform backends.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Guides TDD-style skill creation: pressure scenarios as tests, baseline agent failures, write docs to enforce compliance, verify with RED-GREEN-REFACTOR.
Guides idea refinement into designs: explores context, asks questions one-by-one, proposes approaches, presents sections for approval, writes/review specs before coding.
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