Skip to content

Instantly share code, notes, and snippets.

View JAQuent's full-sized avatar

Jörn Alexander Quent JAQuent

View GitHub Profile
@psychemedia
psychemedia / numbers2words.R
Created July 12, 2015 00:12
R function to convert numbers to words
#https://github.com/ateucher/useful_code/blob/master/R/numbers2words.r
numbers2words <- function(x){
## Function by John Fox found here:
## http://tolstoy.newcastle.edu.au/R/help/05/04/2715.html
## Tweaks by AJH to add commas and "and"
helper <- function(x){
digits <- rev(strsplit(as.character(x), "")[[1]])
nDigits <- length(digits)
if (nDigits == 1) as.vector(ones[digits])
@drewhendrickson
drewhendrickson / gist:7742291
Created December 1, 2013 23:28
Sample plot showing how to transform ggplot2 histogram from frequency to percent.
require(ggplot2)
agg_progress <- data.frame(id=rep(letters[1:10], each=6),
Var1=rep(LETTERS[1:6], times=10),
Freq=floor(100 * runif(60)))
# As frequency
ggplot(agg_progress) + theme_bw() +