Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jjchern committed Feb 8, 2018
1 parent 17fd83d commit 28d51a1
Show file tree
Hide file tree
Showing 35 changed files with 1,695 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
^README\.Rmd$
^LICENSE\.md$
^cran-comments\.md$
^\.travis\.yml$
^appveyor\.yml$
^docs$
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: R
sudo: false
cache: packages
10 changes: 7 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
out.width = "100%",
cache = TRUE
)
```

[![Travis-CI Build Status](https://travis-ci.org/jjchern/gglorenz.svg?branch=master)](https://travis-ci.org/jjchern/gglorenz)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/jjchern/gglorenz?branch=master&svg=true)](https://ci.appveyor.com/project/jjchern/gglorenz)

# About `gglorenz`

The goal of `gglorenz` is to plot Lorenz Curves with the Blessing of `ggplot2`.
Expand All @@ -31,7 +35,7 @@ devtools::install_github("jjchern/gglorenz")

Suppose you have a vector with each element represents the amount the stuff a person produced, and you are interested in knowing how much stuff are produced by the top x% of the people, then the `gglorenz::stat_lorenz(desc = TRUE)` would make a graph for you.

```R
```{r}
library(tidyverse)
library(gglorenz)
Expand All @@ -52,7 +56,7 @@ billionaires %>%
billionaires %>%
filter(Industry %in% c("Technology", "Real Estate")) %>%
ggplot(aes(x = tnw, colour = Industry)) +
ggplot(aes(x = TNW, colour = Industry)) +
stat_lorenz(desc = TRUE) +
coord_fixed() +
geom_abline(linetype = "dashed") +
Expand Down
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->
[![Travis-CI Build Status](https://travis-ci.org/jjchern/gglorenz.svg?branch=master)](https://travis-ci.org/jjchern/gglorenz) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/jjchern/gglorenz?branch=master&svg=true)](https://ci.appveyor.com/project/jjchern/gglorenz)

About `gglorenz`
================

Expand All @@ -23,9 +25,32 @@ Suppose you have a vector with each element represents the amount the stuff a pe

``` r
library(tidyverse)
#> ── Attaching packages ──────────────────────────────────────── tidyverse 1.2.1 ──
#> ✔ ggplot2 2.2.1.9000 ✔ purrr 0.2.4
#> ✔ tibble 1.4.2 ✔ dplyr 0.7.4
#> ✔ tidyr 0.7.2 ✔ stringr 1.2.0
#> ✔ readr 1.1.1.9000 ✔ forcats 0.2.0
#> Warning: package 'tibble' was built under R version 3.4.3
#> ── Conflicts ─────────────────────────────────────────── tidyverse_conflicts() ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag() masks stats::lag()
library(gglorenz)

billionaires
#> # A tibble: 500 x 6
#> Rank Name Total_Net_Worth Country Industry TNW
#> <chr> <chr> <chr> <chr> <chr> <dbl>
#> 1 1 Jeff Bezos $118B United States Technology 118
#> 2 2 Bill Gates $91.3B United States Technology 91.3
#> 3 3 Warren Buffett $86.1B United States Diversified 86.1
#> 4 4 Mark Zuckerberg $74.3B United States Technology 74.3
#> 5 5 Amancio Ortega $71.7B Spain Retail 71.7
#> 6 6 Bernard Arnault $65.0B France Consumer 65.0
#> 7 7 Carlos Slim $64.7B Mexico Diversified 64.7
#> 8 8 Larry Ellison $54.7B United States Technology 54.7
#> 9 9 Larry Page $52.6B United States Technology 52.6
#> 10 10 Sergey Brin $51.2B United States Technology 51.2
#> # ... with 490 more rows

billionaires %>%
ggplot(aes(TNW)) +
Expand All @@ -39,10 +64,15 @@ billionaires %>%
y = "Cumulative Percentage of Total Net Worth",
title = "Inequality Among Billionaires",
caption = "Source: https://www.bloomberg.com/billionaires/")
```

<img src="man/figures/README-unnamed-chunk-1-1.png" width="100%" />

``` r

billionaires %>%
filter(Industry %in% c("Technology", "Real Estate")) %>%
ggplot(aes(x = tnw, colour = Industry)) +
ggplot(aes(x = TNW, colour = Industry)) +
stat_lorenz(desc = TRUE) +
coord_fixed() +
geom_abline(linetype = "dashed") +
Expand All @@ -54,3 +84,5 @@ billionaires %>%
title = "Real Estate is a Relatively Equal Field",
caption = "Source: https://www.bloomberg.com/billionaires/")
```

<img src="man/figures/README-unnamed-chunk-1-2.png" width="100%" />
18 changes: 18 additions & 0 deletions README_cache/markdown_github/__packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
base
methods
datasets
utils
grDevices
graphics
stats
tidyverse
ggplot2
tibble
tidyr
readr
purrr
dplyr
stringr
forcats
gglorenz
bindrcpp
Binary file not shown.
Empty file.
Binary file not shown.
45 changes: 45 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# DO NOT CHANGE the "init" and "install" sections below

# Download script file from GitHub
init:
ps: |
$ErrorActionPreference = "Stop"
Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
Import-Module '..\appveyor-tool.ps1'
install:
ps: Bootstrap

cache:
- C:\RLibrary

# Adapt as necessary starting from here

build_script:
- travis-tool.sh install_deps

test_script:
- travis-tool.sh run_tests

on_failure:
- 7z a failure.zip *.Rcheck\*
- appveyor PushArtifact failure.zip

artifacts:
- path: '*.Rcheck\**\*.log'
name: Logs

- path: '*.Rcheck\**\*.out'
name: Logs

- path: '*.Rcheck\**\*.fail'
name: Logs

- path: '*.Rcheck\**\*.Rout'
name: Logs

- path: '\*_*.tar.gz'
name: Bits

- path: '\*_*.zip'
name: Bits
111 changes: 111 additions & 0 deletions docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions docs/README_cache/html/__packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
base
methods
datasets
utils
grDevices
graphics
stats
tidyverse
ggplot2
tibble
tidyr
readr
purrr
dplyr
stringr
forcats
gglorenz
bindrcpp
Binary file not shown.
Empty file.
Binary file not shown.
Loading

0 comments on commit 28d51a1

Please sign in to comment.