---
title: "Dashboard Tasas México vs EE.UU."
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
theme: cosmo
highlight: tango
source_code: embed
self_contained: true
fig_width: 8
fig_height: 8
fig_retina: 1
---
```{r setup, include=FALSE}
library(tidyverse)
library(lubridate)
# Cargar datos
tasas <- read.csv("tasas.csv")
# Convertir fecha
tasas <- tasas %>%
mutate(Fecha = dmy(Personalizado))
# Calcular spreads
tasas <- tasas %>%
mutate(
Spread_US = US_2Y - US_3M,
Spread_MX = Cetes_728 - Cetes_28,
)
# 📊 Columna 1
##México-EE.UU
### Tasas Cortas
```{r}
ggplot(tasas, aes(x = Fecha)) +
geom_line(aes(y = Cetes_28, color = "México"), linewidth = 1.2) +
geom_line(aes(y = US_3M, color = "EE.UU."), linewidth = 1.2) +
labs(y = "Tasa corta (%)", x = NULL, color = NULL)
###Tasas Largas
ggplot(tasas, aes(x = Fecha)) +
geom_line(aes(y = Cetes_728, color = "México"), linewidth = 1.2) +
geom_line(aes(y = US_2Y, color = "EE.UU."), linewidth = 1.2) +
labs(y = "Tasa larga (%)", x = NULL, color = NULL)
##Tasa larga - Tasa corta por país
###EE.UU
ggplot(tasas, aes(x = Fecha)) +
geom_line(aes(y = Spread_US, color = "EE.UU."), linewidth = 1.2) +
geom_hline(yintercept = 0, linetype = "dashed") +
labs(y = "tasa larga – tasa corta", x = NULL, color = NULL)
###México
ggplot(tasas, aes(x = Fecha)) +
geom_line(aes(y = Spread_MX, color = "México"), linewidth = 1.2) +
geom_hline(yintercept = 0, linetype = "dashed") +
labs(y = "tasa larga – tasa corta", x = NULL, color = NULL)