Skip to content

Instantly share code, notes, and snippets.

View johnmackintosh's full-sized avatar

John MacKintosh johnmackintosh

View GitHub Profile
@johnmackintosh
johnmackintosh / CLAUDE.md
Created August 22, 2025 07:00 — forked from sj-io/CLAUDE.md
Claude R Tidyverse Expert

Modern R Development Guide

This document captures current best practices for R development, emphasizing modern tidyverse patterns, performance, and style. Last updated: August 2025

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
@johnmackintosh
johnmackintosh / data.table-joins.R
Created March 2, 2021 23:27 — forked from nacnudus/data.table-joins.R
How to do joins with data.table
library(data.table)
?`[.data.table`
DT <- data.table(x=rep(c("b","a","c"),each=3), y=c(1,3,6), v=1:9)
X <- data.table(x=c("c","b"), v=8:7, foo=c(4,2))
colnames(DT)
# [1] "x" "y" "v"