modu-ai/cc-plugins

moai-lang-r

R 4.4+ development specialist covering tidyverse, ggplot2, Shiny, and data science patterns. Use when developing data analysis pipelines, visualizations, or Shiny applications.

First seen Jan 24, 2026

Installation

$ npx skills add modu-ai/cc-plugins --skill moai-lang-r

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from modu-ai/cc-plugins · top by installs.

npx skills add modu-ai/cc-plugins

Browse all from modu-ai/cc-plugins

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 67
License Apache-2.0
Default branch main
Open issues 0
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.1.0
LicenseApache-2.0
CompatibilityDesigned for Claude Code
Allowed toolsRead Grep Glob Bash(R:*) Bash(Rscript:*) mcp__context7__resolve-library-id mcp__context7__get-library-docs
Declared agents claude-code
More metadata
version
1.1.0
category
language
status
active
updated
2026-01-11
modularized
true
tags
language, r, tidyverse, ggplot2, shiny, dplyr, data-science

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 8,774 B
  • docs SUMMARY.md 195 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 8 installs

SKILL.md

Quick Reference (30 seconds)

R 4.4+ Development Specialist - tidyverse, ggplot2, Shiny, renv, and modern R patterns.

Auto-Triggers: Files with .R extension, .Rmd, .qmd, DESCRIPTION, renv.lock, Shiny or ggplot2 discussions

Core Capabilities:

  • R 4.4 Features: Native pipe operator, lambda syntax with backslash, improved error messages
  • Data Manipulation: dplyr, tidyr, purrr, stringr, forcats
  • Visualization: ggplot2, plotly, scales, patchwork
  • Web Applications: Shiny, reactivity, modules, bslib
  • Testing: testthat 3.0, snapshot testing, mocking
  • Package Management: renv, pak, DESCRIPTION
  • Reproducible Reports: R Markdown, Quarto
  • Database: DBI, dbplyr, pool

Quick Patterns

dplyr Data Pipeline Pattern:

Load tidyverse library. Create result by piping data through filter for year 2020 or later, mutate adding revenuek as revenue divided by 1000 and growth as current minus lagged revenue divided by lagged revenue, groupby category, then summarise with totalrevenue as sum, avggrowth as mean with na.rm TRUE, and groups set to drop.

ggplot2 Visualization Pattern:

Load ggplot2 library. Create ggplot with data and aes mapping x to date, y to value, and color to category. Add geomline with linewidth 1 and geompoint with size 2. Apply scalecolorviridisd for color scale. Add labs for title, axis labels, and color legend. Apply thememinimal for clean appearance.

Shiny Basic App Pattern:

Load shiny library. Create ui using fluidPage with selectInput for variable selection from mtcars column names and plotOutput for plot. Create server function with input, output, and session parameters. In server, assign renderPlot to output plot using ggplot with mtcars and aes using .data pronoun with input variable for histogram. Create app with shinyApp passing ui and server.


Implementation Guide (5 minutes)

R 4.4 Modern Features

Native Pipe Operator:

Create result by piping data through filter removing NA values, mutate adding logvalue as log of value, and summarise computing meanlog. For non-first argument position, use underscore placeholder in lm formula call with data parameter.

Lambda Syntax with Backslash:

Use map with data and backslash x syntax for x squared. Use map2 with two lists and backslash x y for x plus y. In dplyr contexts, use mutate with across on numeric columns applying backslash x for scale function extracting first column.

tidyverse Data Manipulation

dplyr Core Verbs:

Load dplyr library. Create processed by piping rawdata through filter for active status and positive amount, select for specific columns, mutate adding month using floordate and amountscaled dividing by max, then arrange descending by date. For grouped summaries, pipe through groupby, summarise with n for count, sum and mean for aggregations, and groups drop.

tidyr Reshaping Pattern:

Load tidyr library. For wide to long transformation, use pivotlonger with cols starting with year prefix, namesto for column name, namesprefix to strip, and valuesto for values. For long to wide transformation, use pivotwider with namesfrom and valuesfrom, adding valuesfill for missing value handling.

purrr Functional Programming:

Load purrr library. Use map with files and lambda to readcsv each file. Use mapdfr for row-binding with id parameter for source column. Use mapdbl for extracting numeric results with mean and na.rm TRUE. For error handling, create saferead using safely wrapper on readcsv. Map files through saferead, extract results, and use compact to filter successes.

ggplot2 Visualization Patterns

Complete Plot Structure:

Load ggplot2 and scales libraries. Create p using ggplot with data and aesthetics for x, y, and color by group. Add geompoint with alpha and size, geomsmooth with lm method and standard error. Apply scalexcontinuous with comma labels, scaleylog10 with dollar labels, and scalecolorbrewer with Set2 palette. Add facetwrap by category with freey scales. Add labs for title, subtitle, and axis labels. Apply thememinimal with basesize and theme for legend position. Save with ggsave specifying filename, plot, dimensions, and dpi.

Multiple Plots with patchwork:

Load patchwork library. Create p1 with histogram, p2 with scatter plot, and p3 with boxplot. Combine using pipe and parentheses for layout with p1 beside p2 over p3. Add plotannotation for title and taglevels.

Shiny Application Patterns

Modular Shiny App:

Create dataFilterUI function taking id parameter. Use NS function for namespace. Return tagList with selectInput for category with NULL initial choices and sliderInput for range. Create dataFilterServer function taking id and data reactive. Use moduleServer with inner function. In observe block, extract unique categories and updateSelectInput. Return reactive filtering data by category and range inputs using req for input validation.

Reactive Patterns:

In server function, create processeddata as reactive caching filtered data by input year. Create counter as reactiveVal initialized to 0. Use observeEvent on input increment to update counter. Create analysis as eventReactive on input runanalysis for expensive computation. Apply debounce with 300 milliseconds on search input reactive for rapid input handling.

testthat Testing Framework

Test Structure Pattern:

Load testthat library. Create testthat block for calculategrowth with tibble of years and values. Call function and store result. Use expectequal for row count, expectequal for growth value with tolerance, and expect_true for NA check.

renv Dependency Management

Project Setup:

Call renv::init for initialization. Call renv::install for tidyverse and shiny packages. Call renv::snapshot to record state. Call renv::restore to restore from lockfile.


Advanced Implementation (10+ minutes)

For comprehensive coverage including:

  • Advanced Shiny patterns for async, caching, and deployment
  • Complex ggplot2 extensions and custom themes
  • Database integration with dbplyr and pool
  • R package development patterns
  • Performance optimization techniques
  • Production deployment with Docker and Posit Connect

See:

  • modules/advanced-patterns.md for complete advanced patterns guide

Context7 Library Mappings

  • tidyverse/dplyr for data manipulation verbs
  • tidyverse/ggplot2 for grammar of graphics visualization
  • tidyverse/purrr for functional programming toolkit
  • tidyverse/tidyr for data tidying functions
  • rstudio/shiny for web application framework
  • r-lib/testthat for unit testing framework
  • rstudio/renv for dependency management

Works Well With

  • moai-lang-python for Python and R interoperability with reticulate
  • moai-domain-database for SQL patterns and database optimization
  • moai-workflow-testing for DDD and testing strategies
  • moai-essentials-debug for AI-powered debugging
  • moai-foundation-quality for TRUST 5 quality principles

Troubleshooting

Common Issues:

R Version Check:

Call R.version.string in R console for version 4.4 or later. Call packageVersion with package name to check installed package versions.

Native Pipe Not Working:

  • Ensure R version is 4.1 or later for native pipe operator
  • Check RStudio settings under Tools, Global Options, Code for Use native pipe option

renv Issues:

Call renv::clean to remove unused packages. Call renv::rebuild to rebuild package library. Call renv::snapshot with force TRUE to force snapshot update.

Shiny Reactivity Debug:

Set options shiny.reactlog to TRUE. Call reactlog::reactlog_enable to enable logging. Call shiny::reactlogShow to display reactive log visualization.

ggplot2 Font Issues:

Load showtext library. Call fontaddgoogle with font name and family. Call showtext_auto to enable for all graphics devices.


Last Updated: 2026-01-11 Status: Active (v1.1.0)