#knitr::opts_chunk$set(echo = TRUE)

Welcome to the simple R package "rEconEnv"

The Home Price Index and Interest Rate are important factors in analysis Mortgage data. In this package, we present convenient ways to get these data from https://www.fhfa.gov/DataTools/Downloads/Pages/House-Price-Index-Datasets.aspx and http://www.freddiemac.com/pmms.

If you have an open access to the internet, the functions of these packahe will connect to sites, then download the most recent data and process them. If your running server can't reach these sites (for example, being blocked by your corporate firewall), then you can manually download files and pass the files to the functions for parsing and processing.

Here is the remote data locations used in this package:

The data retuned from functions are in data.table format.

Installation

devtools::install_github("xdderekchen/rEconEnv")

Use the libraries:

library(readxl)
library(data.table)
library(magrittr)
library(curl)
library(dygraphs)
library(rEconEnv)
options(warn=-1)


# 1. get recent National (US) Home Price Index (monthly) since 2010
ushpi_m    <- get_US_hpi(from_year=2010, out.Monthly=TRUE)
#and plotting the data:
plot_HP(dt=ushpi_m,  title="Monthly National HPI" )


# 2. get recent National (US) Home Price Index (quarterly) since 2010
ushpi_q    <- get_US_hpi(from_year=2010, out.Monthly=FALSE)
#and plotting the data:
plot_HP(dt=ushpi_q,  title="Quarterly National HPI" )


# 3. get recent States Home Price Index (monthly) since 2010
statehpi_m    <- get_State_hpi(from_year=2010, out.Monthly=TRUE)
plot_HP(dt=statehpi_m,  regionnames = c("MD", "VA", "CA") , title="Monthly HPI for selected states")

# 4. get recent States Home Price Index (quarterly) since 2000
statehpi_q    <- get_State_hpi(from_year=2000, out.Monthly=FALSE)
plot_HP(dt=statehpi_q,  regionnames = c("MD", "VA", "CA") , title="Quarterly HPI for selected states")

# 5. get recent ZIP3 Home Price Index (monthly) since 2010
zip3hpi_m    <- get_ZIP3_hpi(from_year=2010, out.Monthly=TRUE)
plot_HP(dt=zip3hpi_m,  regionnames = c("010", "011", "012") , title="Monthly HPI for selected zips")

# 6. get recent ZIP3 Home Price Index (quarterly) since 2000
zip3hpi_q    <- get_ZIP3_hpi(from_year=2000, out.Monthly=FALSE)
plot_HP(dt=zip3hpi_q,  regionnames = c("010", "011", "012") , title="Quarterly HPI for selected zips")


# 7. get recent 30yr Fixed Mortgage Interest Rate since 2010
ir30        <- get_IR_FRM30(from_year=2010)
plot_IR(ir30, title="IR rate for FRM30yr")

# 8. get recent 15yr Fixed Mortgage Interest Rate since 2010
ir15         <- get_IR_FRM15(from_year=2010)
plot_IR(ir15, title="IR rate for FRM15yr")

# 9. get recent 30yr and 15yr Fixed Mortgage Interest Rate since 2010
irdata       <- get_IR_FRM_15_30()
plot_IR(irdata, title="IR rate for FRM30yr and FRM15yr")


xdderekchen/rEconEnv documentation built on Feb. 23, 2020, 7:55 a.m.