Skip to content

Instantly share code, notes, and snippets.

@aaronberdanier
aaronberdanier / Sankey.R
Created December 2, 2011 14:50
Program for creating sankey diagrams in R
SankeyR <- function(inputs, losses, unit, labels, format="plot"){
########################
# SankeyR version 1.01 (updated August 10, 2010)
# is a function for creating Sankey Diagrams in R.
# See http://www.sankey-diagrams.com for excellent examples of Sankey Diagrams.
#
# OPTIONS:
# 'inputs' is a vector of input values
# 'losses' is a vector of loss values
# 'unit' is a string of the unit
@hpiwowar
hpiwowar / bibtex_to_csv.py
Created July 1, 2011 22:20
For exporting bibtex info into csv for running stats
#!/usr/bin/env python
# Initially written by Heather Piwowar, June 2011
# Public domain: have at it!
# For exporting bibtex info into csv for running stats
import csv
import re
from pybtex.database.input import bibtex as bibtex_in
from pybtex.database.output import bibtex as bibtex_out
from operator import itemgetter, attrgetter
@sdtaylor
sdtaylor / install_old_packages.R
Last active April 24, 2017 22:29
Install all the packages that were in the prior version of R
prior_version = 3.3
library_path = .libPaths()[1]
library_path = substr(library_path, 1, nchar(library_path)-3)
old_library_path=paste0(library_path, prior_version)
old_packages = list.files(old_library_path)
install.packages(old_packages)
@docsteveharris
docsteveharris / ggMMplot.R
Last active February 16, 2017 16:04
Mosaic plot using ggplot
#' @title Mosaic plot using ggplot.
#'
#' @description
#' Creates a mosaic plot where the dimensions of the cells of a
#' confusion matrix represent their marginal proportions.
#'
#' @details
#' Credit for initial iteration to
#' [Edwin](http://stackoverflow.com/a/19258045/992999)
#' This version adds color brewer options and tidies the labelling
@Thell
Thell / Exmple.Rmd
Created June 20, 2013 23:59
R markdown to illustrate creation of in-document referencing for chunks, sections, pages, and such.
```{r setup, echo=FALSE, results='hide'}
chunkref <- local({
function(chunklabel) {
sprintf('[%s](#%s)', chunklabel, chunklabel )
}
})
secref <- local({
function(seclabel) {
sprintf('[%s](#%s)', seclabel, seclabel )