Commit 532caf45 authored by Thomas Brand's avatar Thomas Brand

Add makefile, with export data function.

parent ac2e37e7
......@@ -5,7 +5,7 @@ output:
toc: true
toc_float: true
runtime: shiny
bibliography: biblio.bib
bibliography: biblio_cmr14_EA.bib
---
......@@ -17,8 +17,6 @@ pacman::p_load(dplyr,magrittr,tidyr,ggplot2,lubridate,knitr,zoo,rjson,grid,rsdmx
opts_chunk$set(message=FALSE, warning=FALSE, cache=FALSE)
ifelse(file.exists("../data/"),NA,dir.create("../data/"))
# theme for ggplot
theme <- theme_bw()+ theme(strip.background=element_blank(),
strip.text=element_text(size=13),
......@@ -392,13 +390,13 @@ The historical long-term interest rates come from the AWM database. The recent a
link_to_awm <- "http://www.eabcn.org/sites/default/files/awm19up15.csv"
if (! "awm19up15.csv" %in% list.files("../data/")) {
if (! "awm19up15.csv" %in% list.files()) {
download.file(link_to_awm,
destfile = "../data/awm19up15.csv",
destfile = "awm19up15.csv",
method = "auto")
}
awm <- read.csv("../data/awm19up15.csv", sep=",")
awm <- read.csv("awm19up15.csv", sep=",")
longrate_old <-
awm %>%
transmute(longrate = LTN, # Long-Term Interest Rate (Nominal)
......@@ -581,7 +579,7 @@ EA_Finance_rawdata <-
spread(key = var, value = values)
EA_Finance_rawdata %>%
write.csv("../data/EA_Finance_rawdata.csv", row.names=FALSE)
write.csv("EA_Finance_rawdata.csv", row.names=FALSE)
shinyApp(
......@@ -622,7 +620,7 @@ EA_CMR_rawdata <-
spread(key = var, value = values)
EA_CMR_rawdata %>%
write.csv("../data/EA_CMR_rawdata.csv", row.names=FALSE)
write.csv("EA_CMR_rawdata.csv", row.names=FALSE)
shinyApp(
......@@ -659,7 +657,7 @@ EA_CMR_data <-
creditspread = (lendingrate - shortrate)/100)
EA_CMR_data %>%
write.csv("../data/EA_CMR_data.csv", row.names=FALSE)
write.csv("EA_CMR_data.csv", row.names=FALSE)
```
```{r echo=FALSE}
......
EA_CMR_data.csv: EA_Finance_data.Rmd
@echo "Build EA_CMR_data.csv..."
@R -e "rmarkdown::render('EA_Finance_data.Rmd')" > /dev/null 2>&1
export-data:
@mkdir -p ../data
@cp EA_Finance_rawdata.csv ../data
@cp EA_CMR_rawdata.csv ../data
@cp EA_CMR_data.csv ../data
clean:
@rm -f .RData
@rm -f *.RData
@rm -f *.Rdata
@rm -f *.Rout
@rm -f *.xlsx
@rm -f *.html
@rm -f *.csv
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment