library(ggplot2)
# Number of bedrooms and price
ggplot(duke_forest, aes(x = as.factor(bed), y = price)) +
geom_boxplot() +
labs(
x = "Number of bedrooms",
y = "Sale price (USD)",
title = "Homes for sale in Duke Forest, Durham, NC",
subtitle = "Data are from November 2020"
)
# Area and price
ggplot(duke_forest, aes(x = area, y = price)) +
geom_point() +
labs(
x = "Area (square feet)",
y = "Sale price (USD)",
title = "Homes for sale in Duke Forest, Durham, NC",
subtitle = "Data are from November 2020"
)
Run the code above in your browser using DataLab