Created
July 12, 2017 20:03
-
-
Save hansthompson/8297de072cb094c0b29eb5340aaee958 to your computer and use it in GitHub Desktop.
get housing data and make a couple plots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2);library(dplyr);library(lubridate) | |
foo <- read.csv("https://s3-us-west-2.amazonaws.com/econresearch/Reports/Core/RDC_InventoryCoreMetrics_Metro_Hist.csv", stringsAsFactors = FALSE) | |
foo <- foo %>% filter(CBSATitle == "Anchorage, AK") %>% | |
mutate(Date = ymd(Month), | |
Month = month(Month, lab = TRUE)) | |
# median price | |
ggplot(foo) + geom_line(aes(x = Date, y = Median.Listing.Price)) + theme_par() + ggtitle("Median Listing Price - Anchorage") + labs(caption = "source: http://research.realtor.com/data/inventory-trends") | |
# n of houses on the market | |
by_year <- foo %>% filter(Date >= ymd("2013-1-1")) %>% mutate(year = year(Date)) %>% filter(Month %in% c("Jan", "Feb", "Mar", "Apr", "May", "Jun")) %>% | |
group_by(year) %>% summarize(New_Listings = sum(New.Listing.Count)) | |
ggplot(by_year) + geom_bar(aes(x = year, y = New_Listings), stat = "identity") + | |
theme_par() + ggtitle("Newly Listed Properies Jan Through Jun - Anchorage") + labs(caption = "source: http://research.realtor.com/data/inventory-trends") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment