knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
devtools::load_all(".")

fannieapi

The fannieapi package is an R interface to Fannie Mae's public API. The package may be used to access Fannie Mae's publicly available datasets on macroeconomic and housing industry specific indicators, as well as survey results from the national housing survey and data points for the home purchase sentiment index.

Installation

This package is not available on CRAN and is under development. You may install it via devtools::install_github.

devtools::install_github("saadaslam/fannieapi")

Example

The interface can currently interact with the housing and economic indicators data. This may be utilized using the get_indicator function. The first argument specifies whether you'd like economic or housing indicators. The second argument specifies the indicator within the housing/economic category.

You must first create an account for free at the API's website. Once an account is created, you must set your API key via the set_api_key function before pulling any data.

set_api_key("YOUR_API_KEY_HERE")

Once this is done, you may run the get_indicator function to get, for example, single family housing starts:

sf_starts <- get_indicator('housing', 'housing-starts-single-family')
head(sf_starts)

Economic indicators are typically broader macroeconomic indicators such as GDP or unemployment rate:

ur_data <- get_indicator("economic", "unemployment-rate-percent")
head(ur_data)

Functionalities also exist for obtaining data from the following data sources:

For the survey data, I stored details on the survey questions into two different datasets: nhs_questions for the National Housing Survey and lender_sentiment_questions for the Mortgage Lender Sentiment Survey.



saadaslam/fannieapi documentation built on May 16, 2019, 9:11 p.m.