Skip to content

Instantly share code, notes, and snippets.

View sergbolshakov's full-sized avatar

Sergey Bolshakov sergbolshakov

  • Komarov Botanical Institute of the Russian Academy of Sciences
  • Saint Petersburg, Russia
View GitHub Profile
@sergbolshakov
sergbolshakov / CLAUDE.md
Last active November 2, 2025 11:58 — 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
# Custom grid for geofacetting in ggplot2 with https://hafen.github.io/geofacet/ package
european_russia <-
data.frame(
row = c(1, 1,
2, 2, 2,
3, 3, 3, 3, 3,
4, 4, 4, 4, 4,
5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6,
# Write function for parallel downloading by record number ---------------------
get_if_records <- function(x) {
# Plan to resolves futures in multisession strategy
future::plan("multisession",
workers = parallelly::availableCores())
# Set up progress bar to monitor status of queries
progressr::handlers(
progressr::handler_progress(
format = ":spin :current/:total (:message) [:bar] :percent in :elapsed ETA: :eta",