Statistical Best Practices

Enforce Tidyverse style and vectorization in R analysis scripts.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/ntluong95/agent-skills-statistics --skill statistical-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Statistical Best Practices
Source: https://github.com/ntluong95/agent-skills-statistics/tree/main/skills/common/best-practices
Command: npx skills add https://github.com/ntluong95/agent-skills-statistics --skill statistical-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenges of writing maintainable, efficient, and reproducible R code by enforcing a set of standardized best practices.

Core Features & Use Cases

  • Code Style Enforcement: Adheres to Tidyverse style guides using styler and lintr.
  • Performance Optimization: Promotes vectorization and efficient data handling with data.table.
  • Project Structure: Guides organization for better reproducibility and collaboration.
  • Defensive Programming: Implements input validation and robust error handling.
  • Use Case: When refactoring a complex R script, apply these best practices to ensure clarity, reduce bugs, and improve execution speed.

Quick Start

Apply the best practices for R code style and vectorization to the script located at /path/to/your/analysis.R.

Frequently Asked Questions about Statistical Best Practices

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

FAQPage Schema
How do I enforce Tidyverse style and clean code principles in R scripts?

Improve R code performance by replacing loops with vectorization and using data.table for efficient data handling. This approach significantly speeds up statistical analysis execution.

What is the best way to organize R analysis scripts for reproducibility?

Organize R analysis scripts for reproducibility by implementing standardized project structures and proper package management. This ensures better collaboration and consistent analytical results.

Can I use defensive programming techniques for input validation in R functions?

Use defensive programming in R functions to implement robust input validation and error handling. This prevents bugs and ensures your statistical analysis scripts execute reliably.

Does applying R best practices require refactoring existing statistical analysis code?

Applying R best practices is ideal when refactoring complex R scripts. It enforces vectorization, style consistency, and defensive coding to clarify logic, reduce bugs, and improve execution speed.