airbnb

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.0     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.2     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.1     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(knitr)

setwd("/Users/rahwahagos/Downloads/Hate_crimes")

airbnb <- read_excel("Airbnb_DC_25.zip")  # or .xlsx

room_counts <- airbnb |>
  count(room_type) |>
  arrange(desc(n))

print(room_counts)
# A tibble: 4 × 2
  room_type           n
  <chr>           <int>
1 Entire home/apt  4863
2 Private room     1305
3 Hotel room         74
4 Shared room        15
unique(airbnb$room_type)
[1] "Private room"    "Entire home/apt" "Shared room"     "Hotel room"     
airbnb_plot <- airbnb |>
  filter(!is.na(price)) |>
  filter(price > 0) |>
  filter(price < 1000) |>
  filter(room_type %in% c("Private room", "Entire home/apt", "Hotel room")) |>
  
  ggplot(aes(x = room_type, y = price, fill = room_type)) +
  geom_boxplot(alpha = 0.7) +
  
  labs(
    title = "Price Distribution by Room Type in Washington D.C.",
    x = "Room Type",
    y = "Price per Night (USD)",
    caption = "Data source: Airbnb DC 2025 dataset",
    fill = "Room Type"
  ) +
  
  scale_fill_manual(values = c(
    "Entire home/apt" = "skyblue",
    "Private room" = "lightgreen", 
    "Hotel room" = "salmon"
  )) +
  
  theme_minimal() +
  coord_cartesian(ylim = c(0, 500))

print(airbnb_plot)

This boxplot visualizes the price distribution for the three most common types of Airbnb listings in Washington, D.C.: entire homes/apartments, private rooms, and hotel rooms. A key insight is that entire homes and hotel rooms have higher median prices compared to private rooms, which are generally more affordable for budget-conscious travelers. Additionally, entire home/apartment listings show the widest price range, indicating a greater variety of luxury and budget options within this category. This suggests that travelers looking for consistent, budget-friendly options would likely find the most predictable prices with private rooms.

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

1 + 1
[1] 2

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).