Skip to content
Back to skills

R Parallel

ASecurity

R parallel computing and high performance packages. Use for multi-core processing, distributed computing, Spark integration, and C++ acceleration with Rcpp.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added June 4, 2026
datagoc++apifrontendbackendperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 18 files and shows the line behind each finding

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill r-parallel --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of R Parallel?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for R Parallel
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-r-parallel/badge)](https://www.skillsdirectory.com/skills/leolin990405-r-parallel)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: r-parallel
description: R parallel computing and high performance packages. Use for multi-core processing, distributed computing, Spark integration, and C++ acceleration with Rcpp.
---

# R Parallel & High Performance Skill

## Sub-skills

| Sub-skill | Description |
|-----------|-------------|
| [r-parallel-local](r-parallel-local/SKILL.md) | parallel, future, furrr, foreach |
| [r-parallel-distributed](r-parallel-distributed/SKILL.md) | sparklyr, batchtools, clustermq |
| [r-parallel-cpp](r-parallel-cpp/SKILL.md) | Rcpp, RcppParallel, RcppArmadillo |

Parallel computing and performance optimization in R.

## Parallel Computing

| Package | Description |
|---------|-------------|
| **future** ★ | Unified parallel/distributed API |
| **furrr** | future + purrr |
| **foreach** | Parallel loops |
| **parallel** | Built-in multicore/snow |
| **doParallel** | Parallel backend for foreach |
| **Rmpi** | MPI interface |
| **batchtools** | HPC cluster support |

## Distributed Computing

| Package | Description |
|---------|-------------|
| **sparklyr** ★ | Spark interface (RStudio) |
| **SparkR** | Spark R frontend |
| **DistributedR** | HP Vertica platform |
| **ddR** | Distributed data structures |

## High Performance

| Package | Description |
|---------|-------------|
| **Rcpp** ★ | C++ integration |
| **cpp11** | Header-only C++ interface |
| **Rcpp11** | C++11 Rcpp redesign |
| **compiler** | JIT compilation |
| **data.table** | Fast data manipulation |

## Quick Examples

```r
# future - unified parallel API
library(future)
plan(multisession, workers = 4)  # Use 4 cores

# Async evaluation
f <- future({
  slow_computation(data)
})
result <- value(f)

# future.apply
library(future.apply)
results <- future_lapply(1:100, function(i) {
  expensive_function(i)
})

# furrr (future + purrr)
library(furrr)
plan(multisession, workers = 4)
results <- future_map(data_list, process_function)
results <- future_map_dfr(files, read_and_process)

# foreach
library(foreach)
library(doParallel)
registerDoParallel(cores = 4)

results <- foreach(i = 1:100, .combine = rbind) %dopar% {
  expensive_function(i)
}

# parallel (base R)
library(parallel)
cl <- makeCluster(4)
results <- parLapply(cl, 1:100, function(i) {
  expensive_function(i)
})
stopCluster(cl)

# Rcpp - C++ acceleration
library(Rcpp)
cppFunction('
  double sumC(NumericVector x) {
    int n = x.size();
    double total = 0;
    for(int i = 0; i < n; ++i) {
      total += x[i];
    }
    return total;
  }
')
sumC(1:1000000)  # Much faster than sum()

# Rcpp with sourceCpp
# save as mycode.cpp
# [[Rcpp::export]]
# double meanC(NumericVector x) {
#   return std::accumulate(x.begin(), x.end(), 0.0) / x.size();
# }
sourceCpp("mycode.cpp")

# Spark with sparklyr
library(sparklyr)
sc <- spark_connect(master = "local")
spark_df <- copy_to(sc, mtcars, "mtcars")

spark_df %>%
  group_by(cyl) %>%
  summarise(mean_mpg = mean(mpg)) %>%
  collect()

spark_disconnect(sc)
```

## Performance Tips

```r
# 1. Vectorize operations
# Bad
for (i in 1:n) result[i] <- x[i] + y[i]
# Good
result <- x + y

# 2. Pre-allocate vectors
# Bad
result <- c()
for (i in 1:n) result <- c(result, compute(i))
# Good
result <- vector("numeric", n)
for (i in 1:n) result[i] <- compute(i)

# 3. Use data.table for large data
library(data.table)
dt <- as.data.table(df)
dt[, mean(value), by = group]

# 4. Profile before optimizing
profvis::profvis({
  your_code()
})

# 5. Use Rcpp for bottlenecks
library(Rcpp)
cppFunction('
  // C++ code for hot loops
')

# 6. Byte compilation
library(compiler)
fast_fn <- cmpfun(slow_fn)
```

## Parallel Patterns

```r
# Map pattern
library(furrr)
plan(multisession, workers = 4)
results <- future_map(items, process_item)

# Reduce pattern
library(foreach)
result <- foreach(i = 1:100, .combine = `+`) %dopar% {
  compute(i)
}

# Chunked processing
library(future.apply)
chunks <- split(data, ceiling(seq_along(data) / chunk_size))
results <- future_lapply(chunks, process_chunk)
final <- do.call(rbind, results)
```

## Resources

- future: https://future.futureverse.org/
- Rcpp: https://www.rcpp.org/
- sparklyr: https://spark.rstudio.com/
- High Performance R: https://adv-r.hadley.nz/perf-improve.html

Files in this skill

  • SKILL.md4.1 KB
  • r-parallel-cpp/Rcpp/SKILL.md1.6 KB
  • r-parallel-cpp/RcppParallel/SKILL.md2.2 KB
  • r-parallel-cpp/SKILL.md2.3 KB
  • r-parallel-distributed/SKILL.md1.8 KB
  • r-parallel-distributed/sparklyr/SKILL.md1.5 KB
  • r-parallel-local/SKILL.md1.9 KB
  • r-parallel-local/doParallel/SKILL.md3.5 KB
  • r-parallel-local/foreach/SKILL.md1.3 KB
  • r-parallel-local/furrr/SKILL.md1.4 KB
  • r-parallel-local/future/SKILL.md1.5 KB
  • r-parallel-local/parallel/SKILL.md3.2 KB
  • sub-skills/r-parallel-cpp/sub-skills/Rcpp/SKILL.md1.6 KB
  • sub-skills/r-parallel-cpp/sub-skills/RcppParallel/SKILL.md2.2 KB
  • sub-skills/r-parallel-distributed/sub-skills/sparklyr/SKILL.md1.5 KB
  • sub-skills/r-parallel-local/sub-skills/foreach/SKILL.md1.3 KB
  • sub-skills/r-parallel-local/sub-skills/furrr/SKILL.md1.4 KB
  • sub-skills/r-parallel-local/sub-skills/future/SKILL.md1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.