An open API service indexing awesome lists of open source software.

https://github.com/dylanjm/yieldr

#rstats package that fetches treasury yield data from the US Treasury Department's website
https://github.com/dylanjm/yieldr

Last synced: over 1 year ago
JSON representation

#rstats package that fetches treasury yield data from the US Treasury Department's website

Awesome Lists containing this project

README

          

# yieldr

[![Build
Status](https://travis-ci.com/dylanjm/yieldr.svg?branch=master)](https://travis-ci.com/dylanjm/yieldr)

[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)

## Installation

You can install yieldr from github with:

``` r
# install.packages("devtools")
devtools::install_github("dylanjm/yieldr")
```

## Basic Usage

As of right now, the package only comes with one function:
`get_treasury_yields()`.

``` r
library(yieldr)
library(dplyr)
library(gganimate)
library(ggplot2)

treasury_dat <- get_treasury_yields(tidy = TRUE)

treasury_dat %>%
filter(!duration %in% c("BC_1MONTH",
"BC_2MONTH",
"BC_30YEARDISPLAY")) %>%
ggplot(aes(x = duration, y = rate, group = NEW_DATE)) +
geom_line() +
scale_x_discrete(labels = c("3M", "6M", "1Y", "2Y",
"3Y", "5Y", "7Y", "10Y", "20Y", "30Y")) +
labs(title = "Year: {frame_time}") +
transition_time(NEW_DATE)
```