R local parallel computing with parallel, future, furrr. Use for multi-core processing.
Scanned 6/4/2026
Install via CLI
openskills install LeoLin990405/r-analytics-skill---
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)
```
No comments yet. Be the first to comment!
This skill helps you track, analyze, and report on keyword ranking positions over time. It monitors both traditional SERP rankings and AI/GEO visibility to provide comprehensive search performance insights.
Find and analyze YouTube competitor channels using YouTube Data API v3. Discover competitors through keyword search, category matching, content similarity, and related channel discovery. Compare metrics, content strategies, and market positioning. Use when users want to (1) Find competitors for their YouTube channel, (2) Analyze competitor performance metrics, (3) Compare their channel against competitors, (4) Identify content gaps and opportunities, (5) Benchmark against similar creators, (6...
Get current weather and forecasts (no API key required).
Focused Signals scout for PostHog projects using revenue analytics. Watches the derived revenue product for upstream failures (Stripe sync stalls, capture regressions), config drift (missing subscription property, currency mix surprises, broken Stripe↔person joins, deferred-revenue gaps), and goal-miss escalations. Emits findings only when they clear the confidence bar; otherwise writes durable memory and closes out empty. Self-contained peer in the signals-scout-* fleet — no dependencies on ...
Focused Signals scout for finding observability gaps in PostHog itself — significant event volumes the team isn't tracking, custom events with no insight or dashboard coverage, insights pointing at events that have stopped firing, dashboards missing related context, critical events with no alerts. Watches the event-stream-vs-saved- inventory delta as the team's product evolves and emits findings recommending new insights, dashboard additions, or alerts when gaps clear the confidence bar. Self...