com um clique
rcpp
R Rcpp package for C++ integration. Use for seamless R and C++ integration.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
R Rcpp package for C++ integration. Use for seamless R and C++ integration.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
R language data analysis and visualization skill. Use when user asks to (1) run R scripts or code, (2) install/update R packages, (3) perform data analysis with R, (4) create visualizations with ggplot2/plotly, (5) statistical analysis, (6) data manipulation with tidyverse/dplyr/data.table. Triggers on keywords like "R语言", "R脚本", "ggplot", "tidyverse", "数据分析", "可视化".
R DALEX package for model explanations. Use for explaining complex machine learning models.
R iml package for interpretable ML. Use for model-agnostic interpretability methods.
R lime package for local explanations. Use for explaining individual predictions with local interpretable models.
R packages for ML interpretability. Use for explaining and interpreting machine learning models.
R vip package for variable importance. Use for computing and visualizing variable importance scores.
| name | Rcpp |
| description | R Rcpp package for C++ integration. Use for seamless R and C++ integration. |
Seamless R and C++ integration.
// myfile.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;
}
library(Rcpp)
sourceCpp("myfile.cpp")
sumC(1:10)
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:10)
// Numeric
NumericVector x;
NumericMatrix m;
// Integer
IntegerVector x;
IntegerMatrix m;
// Character
CharacterVector x;
// Logical
LogicalVector x;
// List
List L;
// DataFrame
DataFrame df;
// [[Rcpp::export]]
NumericVector vecOps(NumericVector x) {
// Create vector
NumericVector y(10);
NumericVector z = clone(x);
// Access elements
double first = x[0];
double last = x[x.size() - 1];
// Named access
x["a"] = 1.0;
// Sugar functions
NumericVector result = sqrt(x) + log(x);
return result;
}
// [[Rcpp::export]]
NumericMatrix matOps(NumericMatrix m) {
int nrow = m.nrow();
int ncol = m.ncol();
// Access element
double val = m(0, 0);
// Row/column
NumericVector row = m.row(0);
NumericVector col = m.column(0);
return m;
}
// [[Rcpp::export]]
List returnList(NumericVector x) {
return List::create(
Named("mean") = mean(x),
Named("sd") = sd(x),
Named("data") = x
);
}
// [[Rcpp::export]]
DataFrame createDF() {
return DataFrame::create(
Named("x") = NumericVector::create(1, 2, 3),
Named("y") = CharacterVector::create("a", "b", "c")
);
}
// Rcpp sugar provides R-like syntax
NumericVector y = abs(x);
NumericVector y = sqrt(x);
NumericVector y = exp(x);
NumericVector y = log(x);
double s = sum(x);
double m = mean(x);
double v = var(x);
double sd = sd(x);
double mn = min(x);
double mx = max(x);
// [[Rcpp::export]]
NumericVector withAttrs(NumericVector x) {
x.attr("dim") = IntegerVector::create(2, 5);
x.attr("class") = "myclass";
return x;
}