library(quantmod)
library(reshape2)
library(ggplot2)
library(googleVis)
#Importing Housing Data
download.file("https://econdata.s3-us-west-2.amazonaws.com/Reports/Core/RDC_Inventory_Core_Metrics_Metro_History.csv",
destfile = "Metro_Hist.csv")
Housing_Metro <- read.csv("Metro_Hist.csv")
# Select Housing Prices for top 20 cities
Housing<- subset(Housing_Metro, Housing_Metro$HouseholdRank=='9')
Housing<-Housing[order(Housing$month_date_yyyymm),]
ratio=Housing$average_listing_price/Housing$median_listing_price
d <- density(ratio)
plot(d, main="Average Prices / Median Prices")
polygon(d, col="red", border="blue")
var0<-Housing$median_listing_price
var1<-Housing$average_listing_price
date <- seq(as.Date("2016-07-01"), by="1 month", length.out=57)
# Creating Charts
ggplot() + geom_line(aes(x=date,y=var0),color='red') +
geom_line(aes(x=date,y=var1),color='blue') +
ylab('Housing Prices')+xlab('Date')+
labs(title=" Median Listing Prices (in Red) and Average Listing Prices (in Blue)")
# Percent Chagnes
var2<-Housing$median_listing_price_yy
var3<-Housing$average_listing_price_yy
date <- seq(as.Date("2016-07-01"), by="1 month", length.out=57)
ggplot() + geom_line(aes(x=date,y=var2),color='red') +
geom_line(aes(x=date,y=var3),color='blue') +
ylab('Housing Prices')+xlab('Date')+
labs(title=" Median Listing Prices (in Red) and Average Listing Prices Y to Y (in Blue)")
barplot(Housing$active_listing_count_yy, main="Active Listing Counting"
,
names.arg = Housing$Month, cex.names = 0.3 )
barplot(Housing$median_days_on_market_yy, main="Days on Market Y to Y"
,
names.arg = Housing$Month, cex.names = 0.3 )
barplot(Housing$pending_listing_count_yy, main="Pending Listing Count Y to Y"
,
names.arg = Housing$Month, cex.names = 0.5 )
barplot(Housing$new_listing_count_yy, main="New Listing Y to Y"
,
names.arg = Housing$Month, cex.names = 0.5 )
# Basic line plot with points
ggplot(data=Housing, aes(x=month_date_yyyymm, y=ratio, group=1)) +
geom_line()+
geom_point()+
labs(title=" Ratio ( Average Price / Median Price) ")
# Basic line plot with points
ggplot(data=Housing, aes(x=month_date_yyyymm, y=active_listing_count, group=1)) +
geom_line(linetype="dashed")+
geom_point()+
labs(title=" Active Listing Count")
No comments:
Post a Comment