# Janitor

> R janitor package for data cleaning. Use for cleaning dirty data and creating tabulations.

- **Type:** Skill
- **Install:** `agentstack add skill-leolin990405-r-analytics-skill-janitor`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [LeoLin990405](https://agentstack.voostack.com/s/leolin990405)
- **Installs:** 0
- **Category:** [Data & Analytics](https://agentstack.voostack.com/c/data-and-analytics)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [LeoLin990405](https://github.com/LeoLin990405)
- **Source:** https://github.com/LeoLin990405/r-analytics-skill/tree/main/sub-skills/r-data/r-data-manipulation/janitor

## Install

```sh
agentstack add skill-leolin990405-r-analytics-skill-janitor
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# janitor

Simple tools for examining and cleaning dirty data.

## Clean Names

```r
library(janitor)

# Clean column names
df % tabyl(category)

# Two-way tabulation
df %>% tabyl(category, group)

# Three-way tabulation
df %>% tabyl(category, group, year)
```

## Tabyl Adornments

```r
df %>%
  tabyl(category, group) %>%
  adorn_totals("row") %>%           # Add row totals
  adorn_totals("col") %>%           # Add column totals
  adorn_percentages("row") %>%      # Convert to row percentages
  adorn_pct_formatting() %>%        # Format percentages
  adorn_ns() %>%                    # Add counts in parentheses
  adorn_title("combined")           # Add title row
```

## Remove Empty

```r
# Remove empty rows and columns
df % get_dupes()

# Find duplicates by specific columns
df %>% get_dupes(name, date)

# Count duplicates
df %>% get_dupes() %>% nrow()
```

## Data Comparison

```r
# Compare data frames
compare_df_cols(df1, df2)

# Check if same columns
compare_df_cols_same(df1, df2)
```

## Excel Dates

```r
# Convert Excel numeric dates
excel_numeric_to_date(44197)  # Returns Date

# Convert Excel datetime
excel_numeric_to_date(44197.5, include_time = TRUE)

# Convert to Excel date
convert_to_date("2021-01-01")
convert_to_datetime("2021-01-01 12:00:00")
```

## Rounding

```r
# Round half up (Excel-style)
round_half_up(2.5)  # Returns 3

# Round to fraction
round_to_fraction(0.37, denominator = 4)  # Returns 0.25
```

## Row-wise Operations

```r
# Add row numbers
df %>% row_to_names(row_number = 1)  # Use first row as names

# Convert first row to names
df %>% row_to_names(1)
```

## Crosstab

```r
# Cross tabulation with statistics
df %>%
  tabyl(var1, var2) %>%
  chisq.test()

# Fisher's exact test
df %>%
  tabyl(var1, var2) %>%
  fisher.test()
```

## Top Levels

```r
# Show top levels of factor
df %>% top_levels(category, n = 5)
```

## Single Value

```r
# Check if column has single value
df %>%
  summarise(across(everything(), ~ n_distinct(.x) == 1))
```

## With dplyr

```r
library(dplyr)

df %>%
  clean_names() %>%
  remove_empty(c("rows", "cols")) %>%
  mutate(date = excel_numeric_to_date(date_col)) %>%
  tabyl(category) %>%
  adorn_pct_formatting()
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [LeoLin990405](https://github.com/LeoLin990405)
- **Source:** [LeoLin990405/r-analytics-skill](https://github.com/LeoLin990405/r-analytics-skill)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-leolin990405-r-analytics-skill-janitor
- Seller: https://agentstack.voostack.com/s/leolin990405
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
