Skip to content

Instantly share code, notes, and snippets.

@theHausdorffMetric
theHausdorffMetric / margintale_blog_1
Created March 4, 2012 19:57
An R Example to create a boxplot of returns of a financial series depending on weekdays
require(quantmod)
require(ggplot2)
require(reshape2)
# The standard definitions of boxplots are non-obvious to interpret for non-statisticians.
# A "the box is fifty percent, the line 95% and there you have 5% outlier points" is
# typically more easily swallowed by practitioners.
# I therefore define two functions which will change the boxplot appearance below.
myBoxPlotSummary <- function(x) {
@theHausdorffMetric
theHausdorffMetric / margintale_blog_2.R
Created April 14, 2012 20:33
Time Series Heatmaps in ggplot2
require(quantmod)
require(ggplot2)
require(reshape2)
require(plyr)
require(scales)
# Download some Data, e.g. the CBOE VIX
getSymbols("^VIX",src="yahoo")
# Make a dataframe
@theHausdorffMetric
theHausdorffMetric / margintale_blog_3.R
Created January 21, 2018 17:38
tidyverse time series heatmaps
# An simple function to turn an xts time series
# into a ggplot calendar heatmap
require(tidyverse)
# The core idea is to transform the data such that one can
# plot "Value" as a function of "WeekOfMonth" versus "DayOfWeek"
# and facet this Year versus Month
xts_heatmap <- function(x){
data.frame(Date=as.Date(index(x)), x[,1]) %>%

Keybase proof

I hereby claim:

  • I am thehausdorffmetric on github.
  • I am danielprobst (https://keybase.io/danielprobst) on keybase.
  • I have a public key ASAx78zoxGpy8RFqRT5I427AztO4ALheH4N7P-uBKHwYswo

To claim this, I am signing this object: