# Decision Tree Analysis

Use when building a decision tree model in R and generating feature importance ranking...

- Repository: https://github.com/aipoch/medical-research-skills (2020 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-09-17
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add aipoch/medical-research-skills --skill decision-tree-analysis -g -a claude-code -y`
Codex: `npx skills add aipoch/medical-research-skills --skill decision-tree-analysis -g -a codex -y`
Cursor: `npx skills add aipoch/medical-research-skills --skill decision-tree-analysis -g -a cursor -y`
Gemini CLI: `npx skills add aipoch/medical-research-skills --skill decision-tree-analysis -g -a gemini-cli -y`

## Description

Use when building a decision tree model in R and generating feature importance ranking outputs. Supports classification and regression, automatic task detection, parameter validation, model evaluation summaries, and exports of feature-importance tables and figures.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)

# Decision Tree Analysis

Use this skill to train a decision tree model from a tabular file and export feature importance ranking results.

## Use This Skill When

- You need a decision tree workflow in R for either classification or regression.
- You need feature importance ranking as a table and a figure.
- You need a command-line workflow with parameter validation and standardized output folders.

## Primary Command

```bash
Rscript scripts/main.R \
  --data_file <input_file> \
  --target_var <target_column> \
  --task_type <auto|classification|regression> \
  --output_dir <output_dir>
```

## Prerequisites

- `Rscript` is available in the shell.
- Required R packages: `optparse`, `data.table`, `rpart`.
- Install missing packages with `Rscript -e 'install.packages(c("optparse", "data.table", "rpart"), repos="https://cloud.r-project.org")'`.

## Core Arguments

The rest: https://github.com/aipoch/medical-research-skills/blob/HEAD/awesome-med-research-skills/Data Analysis/decision-tree-analysis/SKILL.md
