This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
df <- read_excel("Airbnb_DC_25.xlsx")
price_by_room <- df %>%
group_by(room_type) %>%
summarize(avg_price = mean(price, na.rm = TRUE))
ggplot(price_by_room, aes(x = room_type, y = avg_price, fill = room_type)) +
geom_bar(stat = "identity") +
labs(
title = "Average Airbnb Price by Room Type in Washington, DC",
x = "Room Type",
y = "Average Price (USD)",
fill = "Room Type",
caption = "Data source: Airbnb_DC_25.xlsx"
) +
scale_fill_manual(values = c("steelblue", "tomato", "goldenrod", "purple")) +
theme_minimal()
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
f:Write a short paragraph (3–5 sentences) describing:
the visualization you created, and one key insight or pattern you observe in the plot.
Answer: The visualization is a bar graph showing the type of room and the average price. The y-axis shows the average price, while the x-axis shows the type of room. Different colors are used so that it is easy to differentiate between the bars. One key insight or pattern I observed is that the price of a shared room is much more expensive than any other type of abode in a hotel. This could be because shared rooms are more in demand (and if demand increases, price increases) as many travel with their close family members or friends.
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.