r-developmentlisted
Install: claude install-skill aiskillstore/marketplace
# R Development
This skill provides comprehensive guidance for modern R development, emphasizing current best practices with tidyverse, performance optimization, and professional package development.
## Core Principles
1. **Use modern tidyverse patterns** - Prioritize dplyr 1.1+ features, native pipe, and current APIs
2. **Profile before optimizing** - Use profvis and bench to identify real bottlenecks
3. **Write readable code first** - Optimize only when necessary and after profiling
4. **Follow tidyverse style guide** - Consistent naming, spacing, and structure
## Modern Tidyverse Essentials
### Native Pipe (`|>` not `%>%`)
Always use native pipe `|>` instead of magrittr `%>%` (R 4.1+):
```r
# Modern
data |>
filter(year >= 2020) |>
summarise(mean_value = mean(value))
# Avoid legacy pipe
data %>% filter(year >= 2020)
```
### Join Syntax (dplyr 1.1+)
Use `join_by()` for all joins:
```r
# Modern join syntax with equality
transactions |>
inner_join(companies, by = join_by(company == id))
# Inequality joins
transactions |>
inner_join(companies, join_by(company == id, year >= since))
# Rolling joins (closest match)
transactions |>
inner_join(companies, join_by(company == id, closest(year >= since)))
```
Control match behavior:
```r
# Expect 1:1 matches
inner_join(x, y, by = join_by(id), multiple = "error")
# Ensure all rows match
inner_join(x, y, by = join_by(id), unmatched = "error")
```
### Per-Operation Grouping with `.by`
Use `.by` instead of `gr