Agent skill

r-oop

R object-oriented programming guide for S7, S3, S4, and vctrs. Use when designing R classes or choosing an OOP system.

brycew6m4,252★ · +31/wk · 3 repos on radarProfile →
claude-codeNOASSERTION
Install
npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill r-oop --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 7 KB
Bundled scripts: none
Path: skills/55-ab604-claude-code-r-skills/skills/r-oop/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 3,244
Language: Stata
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# R Object-Oriented Programming *S7, S3, S4, and vctrs: choosing the right OOP system for your needs* ## S7: Modern OOP for New Projects - **S7 combines S3 simplicity with S4 structure** - **Formal class definitions with automatic validation** - **Compatible with existing S3 code** ```r # S7 class definition Range <- new_class("Range", properties = list( start = class_double, end = class_double ), validator = function(self) { if (self@end < self@start) { "@end must be >= @start" } } ) # Usage - constructor and property access x <- Range(start = 1, end = 10) x@start # 1 x@end <- 20 # automatic validation # Methods inside <- new_generic("inside", "x") method(inside, Range) <- function(x, y) { y >= x@start & y <= x@end } ``` ## OOP System Decision Matrix ### S7 vs vctrs vs S3/S4 Decision Tree **Start here:** What are you building? ### 1. Vector-like objects (things that behave like atomic vectors) ``` Use vctrs when: - Need data frame integration (columns/rows) - Want type-stable vector operations - Building factor-like, date-like, or numeric-like classes - Need consistent coercion/casting behavior - Working with existing tidyverse infrastructure Examples: custom date classes, units,

What's inside
Steps it walks through
  1. S7: Modern OOP for New Projects
  2. OOP System Decision Matrix
  3. S7 vs vctrs vs S3/S4 Decision Tree
  4. 1. Vector-like objects (things that behave like atomic vectors)
  5. 2. General objects (complex data structures, not vector-like)
  6. Detailed S7 vs S3 Comparison
  7. Practical Guidelines
  8. Choose S7 when you have
  9. Choose vctrs when you need
  10. Choose S3 when you have
  11. S3 Patterns
  12. Basic S3 Class
  13. S3 Inheritance
  14. S7 Patterns
More from Auto-Empirical-Research-Skills
All skills →
About this skill
What does the r-oop skill do?

R object-oriented programming guide for S7, S3, S4, and vctrs. Use when designing R classes or choosing an OOP system.

How do I install it?

Run `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill r-oop --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From brycewang-stanford/Auto-Empirical-Research-Skills, a repository with 3,244 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going