## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 9,
  fig.height = 6
)

## -----------------------------------------------------------------------------
library(CamelRatiosIndex)

# Load built-in example data
data("camel_2015")
data("camel_2022")

# Compute the index
result <- camel_index(camel_2015, camel_2022)

# View the main output
result$index_table

## -----------------------------------------------------------------------------
# Laspeyres-type indices (base year weights)
result$mw_lasp

# Paasche-type indices (current year weights)
result$mw_pash

# Communality weights from base year factor analysis
result$weights_base

# Eigenvalues
result$eigenvalues_base

## -----------------------------------------------------------------------------
# Basic plot
plot_camel_index(result)

# Highlight specific banks
plot_camel_index(result, highlight_banks = c("Absa", "Ecobank", "GCB"))

# Custom styling
plot_camel_index(
  result,
  title = "Ghanaian Banks: 2015 vs 2022",
  subtitle = "CAMEL Index Performance",
  theme_fn = ggplot2::theme_bw
)

## -----------------------------------------------------------------------------
# Example structure
head(camel_2015)

## -----------------------------------------------------------------------------
base_mat <- as.matrix(camel_2015[, -1])
curr_mat <- as.matrix(camel_2022[, -1])
banks <- camel_2015$Bank

result2 <- camel_index(base_mat, curr_mat, bank_names = banks)

## -----------------------------------------------------------------------------
# Print overview
print(result)

# Detailed summary
summary(result)

