# Rscript ./Pipelines/birthrate-pipe-custom/Components/brplot-R-custom/script.R 
# Work in local environment so that functions are saved with env 
local({ 
# Load module input 
assign("brfile", "/home/fos/pmur002/Talks/OpenAPI2014/Slides/Pipelines/birthrate-pipe-custom/Components/birthrate/birthrate.csv") 
# Set working directory 
oldwd <- setwd("./Pipelines/birthrate-pipe-custom/Components/brplot-R-custom") 
# Module source 

births <- read.csv(brfile, col.names=c("year", "births"))

svg("birthrate-R.svg")
plot(births, type="l")
abline(v=1945 +
       as.numeric(as.Date("1945-09-02") - as.Date("1945-01-01"))/365)
dev.off() 
# Reset working directory 
setwd(oldwd) 
# Save module output 
}) # End local() 
