bnp

Some older Bayesian nonparametrics research.
Log | Files | Refs | README | LICENSE

commit c7f9ccf89b0fbe8592024df19e3be3ce0136926b
Author: Jared Tobin <jared@jtobin.ca>
Date:   Sun, 13 Dec 2015 18:14:24 -0500

Initial commit.

Diffstat:
A.gitignore | 4++++
AMakefile | 17+++++++++++++++++
Asrc/gdp.r | 16++++++++++++++++
3 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,4 @@ +reference +data +*swp +debug diff --git a/Makefile b/Makefile @@ -0,0 +1,17 @@ +PROJECT_DIR = $(HOME)/projects/bnp +DATA_DIR = $(PROJECT_DIR)/data/ +INPUT_DATA_DIR = $(PROJECT_DIR)/data/input +RAW_DATA_DIR = $(DATA_DIR)/raw + +# http://data.worldbank.org/indicator/NY.GDP.MKTP.KD.ZG +RAW_GDP_DATA_URL = 'http://api.worldbank.org/v2/en/indicator/ny.gdp.mktp.kd.zg?downloadformat=csv' + +# get raw data +$(RAW_DATA_DIR)/ny.gdp.mktp.kd.zg_Indicator_en_csv_v2.zip: + curl $(RAW_GDP_DATA_URL) > $@ + +# clean raw data (FIXME do more here) +ny.gdp.mktp.kd.zg_Indicator_en_csv_v2.csv: \ + $(RAW_GDP_DATA) + unzip $< $@ && mv $@ $(INPUT_DATA_DIR) + diff --git a/src/gdp.r b/src/gdp.r @@ -0,0 +1,16 @@ +project_dir = '/Users/jtobin/projects/bnp/' +data_dir = paste(project_dir, 'data/input', sep = '/') + +wb_gdp_data = paste( + data_dir + , 'ny.gdp.mktp.kd.zg_Indicator_en_csv_v2.csv' + , sep = '/' + ) + +d = read.csv( + wb_gdp_data + , header = T + , skip = 4 + ) + +