optimizing-r

Profile and benchmark R code to identify performance bottlenecks.

61|6|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/jeremy-allen/claude-skills --skill optimizing-r-jeremy-allen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimizing-r
Source: https://github.com/jeremy-allen/claude-skills/tree/main/optimizing-r
Command: npx skills add https://github.com/jeremy-allen/claude-skills --skill optimizing-r-jeremy-allen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you identify and fix performance bottlenecks in your R code, making your analyses run faster and more efficiently.

Core Features & Use Cases

  • Performance Profiling: Use tools like profvis to pinpoint slow sections of your code.
  • Benchmarking: Compare different approaches to find the most performant solution using bench::mark().
  • Optimization Strategies: Learn when and how to use parallel processing, choose the right data backends (dplyr, data.table, base R), and apply modern purrr patterns.
  • Use Case: You have an R script that takes hours to run. Use this Skill to profile it, identify the slowest function, and then benchmark a rewritten version using data.table or parallel processing to significantly reduce runtime.

Quick Start

Use the optimizing-r skill to profile the attached R script 'my_slow_script.R' to find performance bottlenecks.

Frequently Asked Questions about optimizing-r

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile R code to find performance bottlenecks?

Benchmarking R code compares alternative approaches to find the most performant solution using bench::mark(). This Skill evaluates different data manipulation implementations, measuring execution times to determine the fastest strategy.

What is the best way to optimize slow R scripts using dplyr or data.table?

Optimizing slow R scripts involves comparing data manipulation packages like dplyr and data.table to determine the most efficient backend. This Skill benchmarks strategic implementation choices, guiding you to rewrite code for significantly reduced runtime.

Can I use parallel processing to speed up data manipulation in R?

Parallel processing in R speeds up data manipulation by distributing execution across cores, which this Skill guides you through implementing. It addresses slow execution times by applying modern purrr patterns and parallel strategies for performance enhancement.

When should I switch from base R to data.table for performance optimization?

Switching from base R to data.table for performance optimization is ideal when profiling reveals slow data manipulation operations. This Skill uses profvis to identify bottlenecks and benchmarks alternatives, recommending data.table when it outperforms base R.

Why does my R script take hours to run and how can benchmarking help?

R scripts take hours to run due to inefficient loops or unoptimized data manipulation, which benchmarking addresses by comparing alternative approaches. This Skill uses bench::mark() to measure execution times and identify the most performant solution.