#library(tidyverse) this will load packages that come with the tidyverse system
library(readxl)
library(tidyverse)── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── 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
# This will read the csv file.
room_prices <- read_excel("Airbnb_DC_25.csv")
# group_by(room types)
#sumarize()
room_prices <- room_prices %>%
group_by(room_type) %>%
summarize(avg_price = mean(price, na.rm = TRUE))
# ggplot Creates blank grid
# aes stands for asthetics
# ggeom_col() creates bar charts
# labs() labels items
ggplot(room_prices,
aes(x = room_type,
y = avg_price,
fill = room_type)) +
geom_col() +
labs(
title = "Average Airbnb Price by Room Type in Washington, DC",
x = "Room Type",
y = "Average Price ($)",
fill = "Room Type",
caption = "Source: Airbnb_DC_25 Dataset"
) +
theme_minimal()