R Debugging Expert

Debug R statistical code using traceback() and browser() for error resolution.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/ntluong95/agent-skills-statistics --skill r-debugging-expert
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: R Debugging Expert
Source: https://github.com/ntluong95/agent-skills-statistics/tree/main/skills/common/debugging
Command: npx skills add https://github.com/ntluong95/agent-skills-statistics --skill r-debugging-expert

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a systematic, scientific approach to debugging R code, helping you efficiently identify and fix errors, convergence failures, and unexpected results in statistical analyses.

Core Features & Use Cases

  • Systematic Debugging: Follows the scientific method (Observe, Hypothesize, Experiment, Fix, Verify) for robust error resolution.
  • Leverages R Tools: Utilizes traceback(), browser(), debug(), and options(warn = 2) for interactive problem-solving.
  • Common Error Guidance: Offers solutions for frequent statistical errors like singular matrices, dimension mismatches, NaNs, and convergence failures.
  • Use Case: When your R script fails with a cryptic error message, use this Skill to guide you through the debugging process, from inspecting the call stack to interactively testing hypotheses.

Quick Start

Use the R Debugging Expert skill to help me debug the following R code snippet that is producing a NaN value.

Frequently Asked Questions about R Debugging Expert

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

FAQPage Schema
How do I debug R statistical code producing NaN outputs?

To debug R statistical code producing NaN outputs, systematically observe the error, hypothesize the cause, experiment using browser() and traceback(), apply a fix, and verify the results. This scientific method isolates NaN generation sources.

What is the best way to troubleshoot multicollinearity and convergence failures in R?

Troubleshooting multicollinearity and convergence failures in R requires a hypothesis-driven approach using debug() and options(warn = 2) to interactively inspect singular matrices and model behavior during execution.

How do I fix dimension mismatch errors in R scripts?

Fix dimension mismatch errors in R by utilizing the scientific method: observe the traceback() call stack, hypothesize where matrix dimensions diverge, experiment interactively with browser(), and verify the alignment.

Why does traceback() not show enough detail for my R error?

When traceback() lacks detail for an R error, you can enforce warnings as errors using options(warn = 2) and step through functions interactively using browser() or debug() to inspect variable states.