Back to skills
SKILL.md
R Parallel Local
ASecurityR local parallel computing with parallel, future, furrr. Use for multi-core processing.
- 5 stars
- 0 votes
- 0 copies
- 1 view
- Added June 4, 2026
Security analysis
100/100Pro scans all 6 files and shows the line behind each finding
npx -y skills add LeoLin990405/r-analytics-skill --skill r-parallel-local --agent claude-codeAre you the author of R Parallel Local?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/leolin990405-r-parallel-local)---
name: r-parallel-local
description: R local parallel computing with parallel, future, furrr. Use for multi-core processing.
---
# R Local Parallel Computing
Multi-core processing.
## parallel
```r
library(parallel)
# Detect cores
detectCores()
detectCores(logical = FALSE)
# mclapply (Unix)
results <- mclapply(1:100, function(x) x^2, mc.cores = 4)
# parLapply (all platforms)
cl <- makeCluster(4)
clusterExport(cl, c("data", "my_function"))
clusterEvalQ(cl, library(dplyr))
results <- parLapply(cl, 1:100, function(x) x^2)
stopCluster(cl)
# parSapply
cl <- makeCluster(4)
results <- parSapply(cl, 1:100, function(x) x^2)
stopCluster(cl)
# Load balancing
results <- parLapplyLB(cl, tasks, process_task)
```
## future
```r
library(future)
# Plan
plan(sequential) # Default
plan(multisession) # Background R sessions
plan(multicore) # Forked (Unix)
plan(cluster, workers = 4)
# Future
f <- future({ slow_computation() })
result <- value(f)
# Multiple futures
f1 <- future({ task1() })
f2 <- future({ task2() })
results <- values(list(f1, f2))
# Resolved?
resolved(f)
# Nested
plan(list(
tweak(multisession, workers = 2),
tweak(multisession, workers = 4)
))
```
## furrr
```r
library(furrr)
plan(multisession, workers = 4)
# Parallel map
results <- future_map(1:100, ~ .x^2)
results <- future_map_dbl(1:100, ~ .x^2)
results <- future_map_dfr(files, read_csv)
# With progress
results <- future_map(1:100, ~ .x^2, .progress = TRUE)
# Options
results <- future_map(
data_list,
process_data,
.options = furrr_options(seed = TRUE)
)
```
## foreach
```r
library(foreach)
library(doParallel)
# Setup
cl <- makeCluster(4)
registerDoParallel(cl)
# Parallel loop
results <- foreach(i = 1:100, .combine = c) %dopar% {
i^2
}
# With packages
results <- foreach(i = 1:100, .packages = "dplyr") %dopar% {
# code using dplyr
}
# Nested
results <- foreach(i = 1:10) %:%
foreach(j = 1:10) %dopar% {
i * j
}
stopCluster(cl)
```
Files in this skill
- SKILL.md
- doParallel/SKILL.md
- foreach/SKILL.md
- furrr/SKILL.md
- future/SKILL.md
- parallel/SKILL.md
Attribution
Comments
Loading comments…