Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/frxxxnz/1ACC0216-TB1-2026-1/llms.txt

Use this file to discover all available pages before exploring further.

Three charts in section 3.5 examine when guests arrive and how long they stay. Chart 2 draws multi-year trend lines so year-over-year changes in monthly demand are visible in a single view. Chart 3 collapses across years to show the overall distribution of arrivals by month. Chart 4 plots individual bookings as a jittered scatter to reveal the relationship between weekend nights and weeknight stays within each reservation.

Chart 2 — Tendencia de Reservas por Mes y Año

This line chart groups bookings by arrival_date_month and separates them into one line per year using group = arrival_date_year. Wrapping arrival_date_year in as.factor() inside the color aesthetic ensures ggplot2 uses a discrete color palette rather than a continuous gradient. geom_line(stat = "count") counts the rows in each month-year combination and connects them without needing a pre-aggregated data frame.The chart shows whether demand peaks (e.g., summer months) are consistent across years or shift over time — useful for identifying whether the hotel’s seasonality is stable or evolving.
upc-grupo5-tb1.R
# 2. Demanda de reservas en el tiempo
ggplot(df, aes(x = arrival_date_month, group = arrival_date_year, color = as.factor(arrival_date_year))) +
  geom_line(stat = "count") +
  labs(title = "Tendencia de Reservas por Mes y Año", x = "Mes", y = "Cantidad")
arrival_date_month was converted to a factor earlier in the script (df$arrival_date_month <- as.factor(df$arrival_date_month)). Factor levels default to alphabetical order in R, so month ordering on the x-axis may not match the calendar. Consider releveling if precise month ordering is required.
Chart 3 is a simple bar chart counting arrivals for each month across all years. The fill = "steelblue" argument applies a uniform color since no group comparison is needed. The theme override element_text(angle = 45, hjust = 1) rotates x-axis labels 45 degrees and right-aligns them so that month names do not overlap — a standard adjustment when factor labels are long or numerous.This chart answers which months are structurally busiest, independent of year-to-year variation.
upc-grupo5-tb1.R
# 3. Temporadas de reserva (Distribución por Mes)
ggplot(df, aes(x = arrival_date_month)) +
  geom_bar(fill = "steelblue") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  labs(title = "Distribución de Reservas por Mes", x = "Mes", y = "Total")
Chart 4 is a scatter plot where each point represents one booking. stays_in_weekend_nights is mapped to x and stays_in_week_nights to y. Because many bookings share identical combinations of these two integers, plain geom_point() would produce a heavily overplotted grid. geom_jitter() adds random noise to each point’s position, separating overlapping observations and revealing the true density of the data.The alpha = 0.1 argument sets point opacity to 10%, so areas with many overlapping jittered points appear darker. This makes high-density regions (e.g., 0 weekend nights + 2 weeknight stays) stand out without requiring a separate density layer.The chart reveals whether short-break guests (high weekend nights, low weeknight stays) and business travelers (low weekend nights, high weeknight stays) form distinct clusters.
upc-grupo5-tb1.R
# 4. Relación de noches (Fin de semana vs Semana)
ggplot(df, aes(x = stays_in_weekend_nights, y = stays_in_week_nights)) +
  geom_jitter(alpha = 0.1, color = "darkgreen") +
  labs(title = "Relación de Noches de Fin de Semana vs Semana")
If the jitter spread obscures the integer grid structure, add width = 0.3, height = 0.3 to geom_jitter() to limit how far points are displaced from their true values.

Build docs developers (and LLMs) love