Skip to content
Back to skills

R Parallel Cpp

ASecurity

R high-performance with Rcpp, RcppParallel, RcppArmadillo. Use for C++ integration and optimization.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 4, 2026
datac++performance

Security analysis

A100/100

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

Scanned June 4, 2026

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

Installs into .claude/skills of the current project.

Are you the author of R Parallel Cpp?

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

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

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-cpp
description: R high-performance with Rcpp, RcppParallel, RcppArmadillo. Use for C++ integration and optimization.
---

# R High-Performance Computing

C++ integration.

## Rcpp

```r
library(Rcpp)

# Inline C++
cppFunction('
  double sumC(NumericVector x) {
    int n = x.size();
    double total = 0;
    for(int i = 0; i < n; ++i) {
      total += x[i];
    }
    return total;
  }
')

# Source file
sourceCpp("my_functions.cpp")
```

## C++ File (.cpp)

```cpp
#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
double sumC(NumericVector x) {
  int n = x.size();
  double total = 0;
  for(int i = 0; i < n; ++i) {
    total += x[i];
  }
  return total;
}

// [[Rcpp::export]]
NumericVector cumsumC(NumericVector x) {
  int n = x.size();
  NumericVector out(n);
  out[0] = x[0];
  for(int i = 1; i < n; ++i) {
    out[i] = out[i-1] + x[i];
  }
  return out;
}

// [[Rcpp::export]]
DataFrame createDF() {
  return DataFrame::create(
    Named("x") = NumericVector::create(1, 2, 3),
    Named("y") = CharacterVector::create("a", "b", "c")
  );
}
```

## RcppArmadillo

```cpp
// [[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>

// [[Rcpp::export]]
arma::mat matmultC(arma::mat A, arma::mat B) {
  return A * B;
}

// [[Rcpp::export]]
arma::vec solveC(arma::mat A, arma::vec b) {
  return arma::solve(A, b);
}

// [[Rcpp::export]]
Rcpp::List eigenC(arma::mat X) {
  arma::vec eigval;
  arma::mat eigvec;
  arma::eig_sym(eigval, eigvec, X);
  return Rcpp::List::create(
    Rcpp::Named("values") = eigval,
    Rcpp::Named("vectors") = eigvec
  );
}
```

## RcppParallel

```cpp
// [[Rcpp::depends(RcppParallel)]]
#include <Rcpp.h>
#include <RcppParallel.h>
using namespace RcppParallel;

struct SumWorker : public Worker {
  const RVector<double> input;
  double value;
  
  SumWorker(const NumericVector input) : input(input), value(0) {}
  SumWorker(const SumWorker& sum, Split) : input(sum.input), value(0) {}
  
  void operator()(std::size_t begin, std::size_t end) {
    value += std::accumulate(input.begin() + begin, input.begin() + end, 0.0);
  }
  
  void join(const SumWorker& rhs) { value += rhs.value; }
};

// [[Rcpp::export]]
double parallelSum(NumericVector x) {
  SumWorker sum(x);
  parallelReduce(0, x.length(), sum);
  return sum.value;
}
```

Files in this skill

  • Rcpp/SKILL.md1.6 KB
  • RcppParallel/SKILL.md2.2 KB
  • SKILL.md2.3 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.