Created
June 13, 2020 10:47
-
-
Save olafghanizadeh/96e52537e09b85ea5550ca8c6bf2658e to your computer and use it in GitHub Desktop.
This file contains 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(tidyquant) | |
library(dplyr) | |
library(dygraphs) | |
jpDebt <- tq_get(x = c("DEBTTLJPA188A"), get = "economic.data", from = "1994-01-01") | |
jpDebtSelect <- select(jpDebt, 3) | |
jpDebtTs <- ts(jpDebtSelect, start=c(1994, 1), end=c(2015, 4), frequency=4) | |
jpDebtSmooth <- predict(td(jpDebtTs ~ 1, method = "denton-cholette", conversion = "average")) | |
jpDebtSmooth | |
jpGdp <- tq_get(x = c("JPNRGDPEXP"), get = "economic.data", from = "1994-01-01") | |
jpGdpSelect <- select(jpGdp, 3) | |
jpGdpTs <- ts(jpGdpSelect, start=c(1994, 1), end=c(2015, 4), frequency=4) | |
jpGdpTs | |
data <- cbind(jpDebtTs, jpGdpTs) | |
dygraph(data, main = "Japanese public debt and GDP") %>% | |
dySeries("jpDebtTs", label = "Debt as a share of GDP", axis="y2") %>% | |
dySeries("jpGdpTs", label = "GDP") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment