You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hrbrmstr
dfc0aa71b5
|
9 years ago | |
---|---|---|
R | 9 years ago | |
README_files/figure-markdown_github | 9 years ago | |
man | 9 years ago | |
tests | 9 years ago | |
.Rbuildignore | 9 years ago | |
.gitignore | 9 years ago | |
.travis.yml | 9 years ago | |
DESCRIPTION | 9 years ago | |
LICENSE | 9 years ago | |
NAMESPACE | 9 years ago | |
README.Rmd | 9 years ago | |
README.md | 9 years ago | |
waffle.Rproj | 9 years ago |
README.md
waffle is a packae to make waffle charts (square pie charts)
It uses ggplot2 and returns a ggplot2 object.
The following functions are implemented:
waffle
News
- Version
0.1
released
Installation
devtools::install_github("hrbrmstr/waffle")
Usage
library(waffle)
## Loading required package: ggplot2
# current verison
packageVersion("waffle")
## [1] '1.0'
# basic example
parts <- c(80, 30, 20, 10)
waffle(parts, rows=8)
## Loading required package: RColorBrewer
# slightly more complex example
parts <- c(`Un-breached\nUS Population`=(318-11-79), `Premera`=11, `Anthem`=79)
waffle(parts, rows=8, size=1, colors=c("#969696", "#1879bf", "#009bda"),
title="Health records breaches as fraction of US Population",
xlab="One square == 1m ppl")
waffle(parts/10, rows=3, colors=c("#969696", "#1879bf", "#009bda"),
title="Health records breaches as fraction of US Population",
xlab="One square == 10m ppl")
# replicating an old favourite
# http://graphics8.nytimes.com/images/2008/07/20/business/20debtgraphic.jpg
# http://www.nytimes.com/2008/07/20/business/20debt.html
savings <- c(`Mortgage ($84,911)`=84911, `Auto and\ntuition loans ($14,414)`=14414, `Home equity loans ($10,062)`=10062, `Credit Cards ($8,565)`=8565)
waffle(savings/392, rows=7, size=0.5, colors=c("#c7d4b6", "#a3aabd", "#a0d0de", "#97b5cf"), title="Average Household Savings Each Year", xlab="1 square == $392")
# similar to but not exact
# https://eagereyes.org/techniques/square-pie-charts
professional <- c(`Male`=44, `Female (56%)`=56)
waffle(professional, rows=10, size=0.5, colors=c("#af9139", "#544616"), title="Professional Workforce Makeup")
Test Results
library(waffle)
library(testthat)
date()
## [1] "Wed Mar 18 15:46:55 2015"
test_dir("tests/")
## basic functionality :