Git Product home page Git Product logo

chartrepository's Introduction

Code repository for macroeconomic charts

Introduction

What this repository tries to do

This is a code repository for scripts, which generate frequently used plots on macroeconomic topics based only on publicly available data. The intention is to support knowledge sharing and save programming time.

The repository is platform agnostic, though R and Python code would be preferred.

An overview of available charts can be found in subfolder figures.

Motivation

At some point at work you start to lose track of the charts you have made over the years. You might need to update some charts very regularly and know where to find your highly optimized code. However, there are other charts, which you know you made some years ago, but you cannot find the code anymore. So you start creating a code repository. But how should you organize it?

  • By topic? But some charts are used for multiple topics. For example, macroeconomic overviews as well as real estate factsheets might use visualisations of house prices. So where to you put the code for those charts, unless you want to duplicate it?
  • By data source? But how do you find all charts used for a specific topic, if you are not aware of all the relevant data sources?

In this repository, I propose tags embedded in the first line of a script. Those tags can be searched and no further structuring of the scripts is necessary. This ensures that the code for one chart is only included once and thematic overlaps are possible.

Usage

Finding code

  • Create a local copy of this repository and open the project.
  • You can use the following code to search the list of tags for a specific topic
# Specify the topics you are interested in
tags <- c("rre")

# Load list of tags and associated scripts
tagindex <- read.csv("tagindex.csv")
result <- NULL
for (i in tags) {
  temp <- dplyr::filter(tagindex, tag == i)
  result <- dplyr::bind_rows(result, temp)
}

# Show relevant files
result
##   tag                                          file
## 1 rre     bank_credit_growth_by_sector_line_chart.R
## 2 rre                   bank_credit_new_by_sector.R
## 3 rre               bank_credit_stock_composition.R
## 4 rre bank_household_rre_credit_growth_line_chart.R
## 5 rre                         bank_interest_rates.R
## 6 rre           rre_price_growth_for_eu_countries.R
## 7 rre            rre_rent_growth_for_eu_countries.R
  • Use the code in the R-files to make your own chart

Adding a new script

  • Add code for a single plot in a new R script in the folder scripts.
  • Save the resulting chart in a png file in folder figures. The file should have the same name as the R script.
  • Tag the code using just a comment in the first (!) line of the new script.
  • Update the index using the following lines
source("functions/update_index.R")
update_index()
  • Feel free to create a pull request, if you want to share your code.

Contributors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.