r-ops
БесплатноЗапускает вложенные скриптыНе проверенModern R for data analysis and statistics — tidyverse-first (dplyr, tidyr, ggplot2, native |> pipe), with base R and data.table as alternatives. Triggers on…
от 0xDarkMatter★ 86 звёзд на GitHubОб этом скилле
Modern R Operations
A tidyverse-first, current-best-practice reference for working in R (2024+): data analysis, statistics, visualization, and reproducible workflow. Opinionated where the community has converged, with base R and data.table flagged as the right tool when they are.
The modern R stack at a glance
| Job | Reach for | Not (anymore) |
|---|---|---|
| Pipe | native |> (R 4.1+) |
%>% only when you need its placeholder/. features |
| Data frame | tibble |
data.frame defaults (but it's fine) |
| Wrangle | dplyr + tidyr |
hand-rolled [, subset, aggregate |
| Read CSV | readr::read_csv (prod), data.table::fread (speed) |
read.csv |
| Excel / Parquet / DB | readxl / arrow / DBI+dbplyr |
— |
| Strings / dates / factors | stringr / lubridate / forcats |
base grepl/POSIXlt/factor juggling |
| Plot | ggplot2 |
base graphics (fine for throwaway plots) |
| Iterate | purrr::map_* + across() |
sapply (type-unstable); lapply ok in package code |
| Big / fast | data.table (or dtplyr, arrow+duckdb) |
— |
| Model | base lm/glm + broom; tidymodels for CV/tuning |
caret |
| Time series | tsibble + fable |
forecast::auto.arima (maintenance-only) |
| Reports | Quarto (.qmd) |
R Markdown (still works) |
| Reproducibility | renv + Projects + here() |
setwd(), saving .RData |
The analysis workflow (and where each reference lives)
import → tidy → transform → visualize → model → communicate
- Import — get data in: import-io.md
- Tidy & transform — the dplyr/tidyr core: tidyverse-core.md
- Clean types — strings, dates, factors: strings-dates-factors.md
- Iterate — map over many things, list-columns: iteration-functional.md
- Visualize — ggplot2 + EDA: visualization.md
- Model — tests, lm/glm, broom, tidymodels: modeling-stats.md
- Scale up — when dplyr is too slow: data-table.md
- Time series — tsibble/fable, xts: time-series.md
- Ship it — projects, renv, Quarto, testing: workflow-tooling.md
Open the reference for the task at hand — they load on demand. For broad orientation, this file is enough.
Core idioms (internalize these)
library(tidyverse)
# The native pipe threads a value into the first argument.
diamonds |>
filter(carat > 0.5) |>
mutate(price_per_carat = price / carat) |>
summarise(
mean_ppc = mean(price_per_carat),
n = n(),
.by = cut # per-operation grouping (dplyr 1.1+)
) |>
arrange(desc(mean_ppc))
# across() applies one op to many columns
df |> summarise(across(where(is.numeric), \(x) mean(x, na.rm = TRUE)))
# map over a list/vector, type-stable; combine results
files |> map(read_csv) |> list_rbind(names_to = "source")
# ggplot: data + aesthetic mapping + layered geoms
ggplot(df, aes(x = displ, y = hwy, colour = class)) +
geom_point() +
geom_smooth(method = "lm")
Decision shortcuts
Grouping: prefer per-operation .by = over group_by() |> ... |> ungroup() — it avoids sticky-group bugs.
Joins: always write join_by(...) explicitly. Natural joins on shared names are almost always wrong on real data.
Which CSV reader? read_csv (readable, good defaults, production) · fread (fastest, big files) · vroom (many files, column subset).
dplyr or data.table? dplyr for readability and teams; data.table (or dtplyr) when profiling says dplyr is the bottleneck or data is large. arrow+duckdb for larger-than-memory.
lm or tidymodels? Base lm/glm is the right default — reach for tidymodels only when you need cross-validation, tuning, or uniform multi-model comparison.
base R or tidyverse? Tidyverse for analysis, readability, teams. Base R (or data.table) for package development, minimal-dependency scripts, and performance-critical inner loops. The |> pipe is base and dependency-free — use it everywhere.
High-value gotchas
These bite people repeatedly — full detail in the referenced files:
stringsAsFactorsisFALSEsince R 4.0 (2020). Old advice warning about automatic factor conversion on import is stale and sometimes backwards. (import-io)predict(glm_model, type = "response")for probabilities — the default returns link-scale (log-odds). (modeling-stats)cor.test(), notcor()when you care whether a correlation is real. (modeling-stats)sapplyis type-unstable — never in function bodies; use a typedmap_*. (iteration-functional)map_dfr/map_dfcare superseded →map() |> list_rbind()/list_cbind(). (iteration-functional)- ggplot mapping vs setting:
aes(colour = class)maps a variable
Установить r-ops в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteBashВложенные файлы
FAQ
Что делает скилл r-ops?
Modern R for data analysis and statistics — tidyverse-first (dplyr, tidyr, ggplot2, native |> pipe), with base R and data.table as alternatives. Triggers on: R, Rstats, tidyverse, dplyr, tidyr, ggplot2, pivot/join/group, data.table, purrr map, broom, renv, Quarto.
Как установить скилл r-ops?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл r-ops запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic