---
title: "Getting Started with Rbearcat"
output: Rbearcat::UC_html_document
vignette: >
  %\VignetteIndexEntry{Getting Started with Rbearcat}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 7,
  fig.height = 4.5,
  fig.align = "center",
  warning = FALSE,
  message = FALSE
)
```

## Overview

**Rbearcat** is a University of Cincinnati R package for Econometrics and Data
Science. It provides:
- **UC-branded ggplot2 themes** and official UC color scales, plus
  colorblind-friendly alternatives
- **Publication-quality tables** for regression, summary statistics, and
  correlation matrices
- **Plot wrappers** for common chart types (bar, line, scatter, histogram, box,
  coefficient, diagnostics, time series, area)
- **Number formatters** for inline reporting (dollar, percent, comma, scientific,
  date, p-value)
- **RMarkdown and Quarto templates** for UC-branded documents and presentations

## Installation

Install from GitHub:

```{r install, eval = FALSE}
# install.packages("remotes")
remotes::install_github("your-org/Rbearcat")
```

## Loading the Package

```{r load}
library(Rbearcat)
library(ggplot2)
```

## UC Themes

Rbearcat ships with four ggplot2 themes. Each applies UC styling with official
UC red accents, Bearcats Black text, and light neutral gridlines.
`set_UC_geoms()` optionally sets default geom colors for the session.

```{r set-geoms}
set_UC_geoms()
```

### `theme_UC()` - the default

Both horizontal and vertical gridlines with an outer panel border.

```{r theme-uc}
p <- ggplot(iris, aes(Petal.Width, Petal.Length, color = Species)) +
  geom_point(size = 2) +
  labs(title = "Iris: Petal Width vs Length",
       subtitle = "Default UC Theme",
       x = "Petal Width", y = "Petal Length")

p + theme_UC()
```

### `theme_UC_hgrid()` - horizontal gridlines only

Best for bar charts where horizontal gridlines aid value reading.

```{r theme-hgrid}
p + theme_UC_hgrid()
```

### `theme_UC_vgrid()` - vertical gridlines only

Best for horizontal bar charts and coefficient plots.

```{r theme-vgrid}
p + theme_UC_vgrid()
```

### `theme_UC_nogrid()` - no gridlines

Clean look for diagnostic panels or dense multi-panel layouts.

```{r theme-nogrid}
p + theme_UC_nogrid()
```

### Options

All themes accept `legend_position` (`"bottom"` or `"right"`) and
`legend_hide` (`TRUE`/`FALSE`).

```{r theme-options}
p + theme_UC(legend_position = "right")
```

## Color Palettes

Rbearcat includes three named palettes. `palette_UC` contains the official UC
primary and expanded brand colors used throughout the package.

### Okabe-Ito (colorblind-friendly)

```{r pal-oi}
scales::show_col(palette_OkabeIto, ncol = 4)
```

A lighter variant is also available:

```{r pal-oi-light}
scales::show_col(palette_OkabeIto_light, ncol = 4)
```

### UC Palette

```{r pal-uc}
scales::show_col(palette_UC, ncol = 4)
```

## Color Scales for ggplot2

Use `scale_color_UC()` / `scale_fill_UC()` inside any ggplot for the default UC
expanded palette. `scale_color_OkabeIto()` and `scale_fill_OkabeIto()` remain
available when you want a dedicated colorblind-friendly alternative.

```{r color-scales}
ggplot(iris, aes(Sepal.Length, fill = Species)) +
  geom_density(alpha = 0.7) +
  scale_fill_UC() +
  labs(title = "Density Plot with UC Fill Scale") +
  theme_UC_hgrid()
```

## Quarto Templates

Create a UC-branded Quarto document in your working directory:

```{r quarto, eval = FALSE}
bcat_new_quarto("html")
bcat_new_quarto("pdf")
bcat_new_quarto("revealjs", path = "slides/")
```

## Next Steps

- **Tables**: See `vignette("tables")` for regression, summary, and correlation
  tables
- **Plots**: See `vignette("plots")` for all nine plot functions
- **Formatting**: See `vignette("formatting")` for inline number formatters
