
r-expert
Expert-level R statistical computing, data analysis, and visualization. Use when the user mentions statistics, data analysis, ggplot2, or the tidyverse, or when the task involves R Fundamentals, Statistical Analysis, Data Visualization, or Code Style.
- Installs
- 329
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/personamanagmentlayer/pcl --skill r-expert- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads r-expert automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
R Statistical Computing Expert
Expert guidance for R programming, statistical analysis, data visualization, and data science.
Core Concepts
R Fundamentals
- Vectors and data frames
- Factors and lists
- Functions and apply family
- Packages and libraries
- R Markdown
- Tidyverse ecosystem
Statistical Analysis
- Descriptive statistics
- Hypothesis testing
- Regression analysis
- ANOVA
- Time series analysis
- Machine learning
Data Visualization
- ggplot2
- Base R graphics
- Interactive plots (plotly)
- Statistical charts
- Maps and spatial data
R Basics
# Vectors
numbers <- c(1, 2, 3, 4, 5)
names <- c("Alice", "Bob", "Charlie")
# Data frames
df <- data.frame(
id = 1:5,
name = c("Alice", "Bob", "Charlie", "David", "Eve"),
age = c(25, 30, 35, 28, 32),
salary = c(50000, 60000, 55000, 52000, 58000)
)
# Subsetting
df[df$age > 30, ] # Rows where age > 30
df[, c("name", "age")] # Select columns
# Functions
calculate_mean <- function(x) {
sum(x) / length(x)
}
# Apply family
sapply(df$age, function(x) x * 2)
lapply(list(1:5, 6:10), sum)
# Control structures
if (mean(df$age) > 30) {
print("Average age is above 30")
} else {
print("Average age is 30 or below")
}
# Loops
for (i in 1:nrow(df)) {
print(df$name[i])
}
Tidyverse
library(dplyr)
library(tidyr)
library(stringr)
# dplyr operations
df %>%
filter(age > 28) %>%
select(name, age, salary) %>%
mutate(
salary_bonus = salary * 1.1,
age_group = case_when(
age < 30 ~ "Young",
age < 35 ~ "Mid-career",
TRUE ~ "Senior"
)
) %>%
arrange(desc(salary)) %>%
group_by(age_group) %>%
summarise(
count = n(),
avg_salary = mean(salary),
total_salary = sum(salary)
)
# Reshaping data
wide_data <- data.frame(
id = 1:3,
year_2021 = c(100, 200, 150),
year_2022 = c(120, 210, 160)
)
# Wide to long
long_data <- wide_data %>%
pivot_longer(
cols = starts_with("year"),
names_to = "year",
values_to = "value",
names_prefix = "year_"
)
# Long to wide
wide_again <- long_data %>%
pivot_wider(
names_from = year,
values_from = value,
names_prefix = "year_"
)
# String operations
df %>%
mutate(
name_upper = str_to_upper(name),
name_length = str_length(name),
first_letter = str_sub(name, 1, 1)
)
# Joining data
df1 <- data.frame(id = 1:3, value1 = c("A", "B", "C"))
df2 <- data.frame(id = 2:4, value2 = c("X", "Y", "Z"))
inner_join(df1, df2, by = "id")
left_join(df1, df2, by = "id")
full_join(df1, df2, by = "id")
ggplot2 Visualization
library(ggplot2)
# Basic scatter plot
ggplot(df, aes(x = age, y = salary)) +
geom_point(size = 3, color = "blue") +
geom_smooth(method = "lm", se = TRUE) +
labs(
title = "Age vs Salary",
x = "Age (years)",
y = "Salary ($)"
) +
theme_minimal()
# Bar plot with facets
ggplot(df, aes(x = name, y = salary, fill = age_group)) +
geom_col() +
facet_wrap(~ age_group) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
# Box plot
ggplot(df, aes(x = age_group, y = salary)) +
geom_boxplot(fill = "lightblue") +
geom_jitter(width = 0.2, alpha = 0.5)
# Histogram with density
ggplot(df, aes(x = salary)) +
geom_histogram(aes(y = ..density..), bins = 10, fill = "steelblue") +
geom_density(color = "red", size = 1)
# Time series
ggplot(time_series_df, aes(x = date, y = value)) +
geom_line(color = "darkgreen") +
geom_point() +
scale_x_date(date_breaks = "1 month", date_labels = "%b %Y") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
Statistical Analysis
# Descriptive statistics
summary(df)
mean(df$age)
median(df$salary)
sd(df$age)
var(df$salary)
quantile(df$age, probs = c(0.25, 0.5, 0.75))
# Correlation
cor(df$age, df$salary)
cor.test(df$age, df$salary)
# T-test
t.test(df$salary ~ df$gender)
# ANOVA
model <- aov(salary ~ age_group, data = df)
summary(model)
TukeyHSD(model)
# Linear regression
lm_model <- lm(salary ~ age + experience, data = df)
summary(lm_model)
# Predictions
new_data <- data.frame(age = c(30, 35), experience = c(5, 8))
predict(lm_model, new_data, interval = "confidence")
# Multiple regression
multi_model <- lm(salary ~ age + experience + education, data = df)
summary(multi_model)
# Check assumptions
par(mfrow = c(2, 2))
plot(multi_model)
# Logistic regression
logit_model <- glm(outcome ~ age + salary,
data = df,
family = binomial(link = "logit"))
summary(logit_model)
Time Series Analysis
library(forecast)
# Create time series
ts_data <- ts(data, start = c(2020, 1), frequency = 12)
# Decomposition
decomposed <- decompose(ts_data)
plot(decomposed)
# ARIMA model
auto_arima <- auto.arima(ts_data)
summary(auto_arima)
# Forecasting
forecast_result <- forecast(auto_arima, h = 12)
plot(forecast_result)
# Accuracy metrics
accuracy(forecast_result)
Machine Learning
library(caret)
library(randomForest)
# Split data
set.seed(123)
train_index <- createDataPartition(df$outcome, p = 0.8, list = FALSE)
train_data <- df[train_index, ]
test_data <- df[-train_index, ]
# Train model
rf_model <- randomForest(
outcome ~ .,
data = train_data,
ntree = 500,
importance = TRUE
)
# Predictions
predictions <- predict(rf_model, test_data)
# Confusion matrix
confusionMatrix(predictions, test_data$outcome)
# Feature importance
importance(rf_model)
varImpPlot(rf_model)
# Cross-validation
train_control <- trainControl(
method = "cv",
number = 10,
savePredictions = TRUE
)
cv_model <- train(
outcome ~ .,
data = train_data,
method = "rf",
trControl = train_control
)
print(cv_model)
R Markdown
---
title: "Analysis Report"
author: "Data Scientist"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
code_folding: hide
---
## Introduction
This analysis explores the relationship between variables.
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(tidyverse)
Data Loading
df <- read.csv("data.csv")
head(df)
Visualization
ggplot(df, aes(x = x, y = y)) +
geom_point() +
theme_minimal()
Results
The analysis shows that r cor(df$x, df$y) correlation.
## Data Import/Export
```r
# CSV
df <- read.csv("data.csv")
write.csv(df, "output.csv", row.names = FALSE)
# Excel
library(readxl)
library(writexl)
df <- read_excel("data.xlsx", sheet = "Sheet1")
write_xlsx(df, "output.xlsx")
# JSON
library(jsonlite)
df <- fromJSON("data.json")
write_json(df, "output.json")
# Database
library(DBI)
library(RSQLite)
con <- dbConnect(SQLite(), "database.db")
df <- dbReadTable(con, "table_name")
dbWriteTable(con, "new_table", df)
dbDisconnect(con)
# Web APIs
library(httr)
response <- GET("https://api.example.com/data")
data <- content(response, as = "parsed")
Best Practices
Code Style
- Use <- for assignment
- Follow tidyverse style guide
- Write functions for repeated code
- Use meaningful variable names
- Comment complex operations
- Use %>% pipe for readability
Data Analysis
- Always explore data first
- Check for missing values
- Validate assumptions
- Use visualization
- Document your analysis
- Make analysis reproducible
Performance
- Vectorize operations
- Use data.table for large data
- Avoid growing objects in loops
- Profile code with Rprof()
- Use parallel processing
- Cache expensive computations
Anti-Patterns
❌ Growing vectors in loops ❌ Not setting random seed ❌ Ignoring NA values ❌ Using attach() ❌ Not documenting code ❌ Hardcoding file paths ❌ Not checking assumptions
Resources
- R Documentation: https://www.r-project.org/
- Tidyverse: https://www.tidyverse.org/
- ggplot2: https://ggplot2.tidyverse.org/
- R for Data Science (book): https://r4ds.had.co.nz/
- CRAN Task Views: https://cran.r-project.org/web/views/
FAQ
What does the r-expert skill do?
Expert-level R statistical computing, data analysis, and visualization. Use when the user mentions statistics, data analysis, ggplot2, or the tidyverse, or when the task involves R Fundamentals, Statistical Analysis, Data Visualization, or Code Style.
How do I install r-expert?
Run npx skills add https://github.com/personamanagmentlayer/pcl --skill r-expert in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/r-expert/ (personal) or .claude/skills/r-expert/ (project).
Which AI agents can use r-expert?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is r-expert safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains r-expert?
It is published by personamanagmentlayer/pcl in personamanagmentlayer/pcl. It has 329 recorded installs.
More from personamanagmentlayer/pcl
finance-expert
personamanagmentlayer/pcl
Designs, reviews, operates and audits systems that hold, move, account for and report money — ledgers, payments, banking and open finance, reconciliation and close, risk, fraud, AML, markets and portfolio accounting, and corporate finance/FP&A. Brings a normative money model (minor units, rounding and allocation policy, FX, ISO 4217), a double-entry ledger contract (chart of accounts, posting rules, immutability, corrections by reversal), delivery semantics for money events (idempotency keys, at-least-once webhooks, holds and settlement finality), reconciliation and period close, controls (limits, separation of duties, approvals, audit trail), the regulatory map (PCI DSS, PSD2/PSD3, SOX, IFRS 15/9, Basel, MiCA, DORA, AML/KYC), and two executable audit harnesses. Use it whenever a task touches an amount of money — a balance, a charge, a refund, a payout, a transfer, an invoice, a fee, a tax, an FX conversion, an interest accrual, a journal entry, a trial balance, a settlement file, a ch
telecommunications-expert
personamanagmentlayer/pcl
Expert-level telecommunications systems, network management, billing, 5G, SDN, and telecom infrastructure. Use when the user mentions telecom, networking, 5G, billing, OSS, or BSS, or when the task involves Telecommunications Systems, Network Technologies, Standards and Protocols, or Network Management.
trading-expert
personamanagmentlayer/pcl
Expert-level algorithmic trading, market systems, quantitative analysis, and trading platforms. Use when the user mentions algorithmic trading, quant, markets, finance, or high-frequency trading, or when the task involves Trading Systems, Market Data, or Execution.
real-estate-expert
personamanagmentlayer/pcl
Expert-level real estate systems, property management, MLS integration, CRM, virtual tours, and market analysis. Use when the user mentions property, MLS, CRM, proptech, or listings, or when the task involves Real Estate Systems, PropTech Solutions, Standards and Regulations, or Listing Management.
banking-expert
personamanagmentlayer/pcl
Expert-level banking systems, core banking, regulations, and banking technology. Use when the user mentions finance, core banking, regulations, or payments, or when the task involves Banking Systems or Key Technologies.
insurance-expert
personamanagmentlayer/pcl
Expert-level insurance systems, underwriting, claims processing, actuarial analysis, risk assessment, and insurtech solutions. Use when the user mentions underwriting, claims, actuarial, risk, or insurtech, or when the task involves Insurance Systems, Insurance Types, Standards and Regulations, or Claims Processing.
Popular productivity & automation skills
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.
lark-doc
open.feishu.cn
飞书云文档(Docx / Wiki)内容操作:读取、创建、编辑文档,插入或下载图片附件,以及操作思维笔记。用户提供文档 URL/token(包括 doubao.com 的 /docx/、/wiki/)时使用;按 URL 路径/token 而非域名路由;/page/ 是妙搭应用,非飞书云文档。文档内嵌资源按读取参考中的统一规则分流。独立评论操作走 lark-drive;随正文读取评论使用 docs +fetch。表格或 Base 内部数据操作不在本 skill。
lark-shared
open.feishu.cn
Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling notice JSON.
lark-drive
open.feishu.cn
飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。
lark-base
open.feishu.cn
飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。
lark-im
open.feishu.cn
飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。