Assignemnt 5

Airbnb Data Visualization

Author: Mohamed Dione

library(readxl)
library(readr)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(ggplot2)
library(treemapify)

#load dataset
df <- read_excel("~/Downloads/Airbnb_DC_25.xlsx")
names (df)
 [1] "id"                             "name"                          
 [3] "host_id"                        "host_name"                     
 [5] "neighbourhood_group"            "neighbourhood"                 
 [7] "latitude"                       "longitude"                     
 [9] "room_type"                      "price"                         
[11] "minimum_nights"                 "number_of_reviews"             
[13] "last_review"                    "reviews_per_month"             
[15] "calculated_host_listings_count" "availability_365"              
[17] "number_of_reviews_ltm"          "license"                       
#creation of the summatry table 
df_summary<- df %>%
  group_by(room_type) %>%
  summarize(total_listings =n())
#creation of the treemap
ggplot(df_summary,
       aes(area = total_listings,
           fill = room_type,
           label = room_type)) +
  geom_treemap() +
  geom_treemap_text(colour = "black",
                    place = "centre",
                    grow = TRUE) +
  scale_fill_manual(values = c("red","yellow","green","blue")) +
  labs(
    title = "Distribution of Airbnb Listings by Room Type in Washington DC",
    place= "center",
    caption = "Source: Airbnb_DC_25 Dataset"
  )
Ignoring unknown labels:
• place : "center"

Description of my plot:

This visualization is a treemap that shows the distribution of Airbnb listings by room type in Washington, DC. The size of each rectangle represents the number of listings in each room type category, allowing us to easily compare their proportions. From the plot, we can see that entire homes/apartments make up the largest share of Airbnb listings, occupying most of the treemap area. A key insight from this visualization is that entire homes are significantly more common than private, hotel, or shared rooms in the Washington, DC Airbnb market.