README.md

title: "ggsupplyDemand"
author: "David Salazar"
date: "2018-05-19"
output:
  html_document:
    keep_md: true

What is it?

ggsupplyDemand is a package that makes it extremely easy to plot supply and demand systems with ggplot2.

library(ggsupplyDemand)

create_supply_and_demand() %>% 
  shift_demand(outwards = TRUE) %>% 
  plot_supply_and_demand(consumer_surplus = TRUE)

Acknowledgment

ggsupplyDemand wouldn't exist without Andrew Heiss from Brigham Young University and his post doing most of the heavylifting that ggsupplyDemand leverages.

Install it!

if (!require(devtools)) {
  install.packages("devtools")
}
devtools::install_github("David-Salazar/ggsupplyDemand")

How does it work?

Build step-by-step a tibble that represents a system of supply and demand. Use create_supply_and_demand() and shift_demand(), shift_supply().

create_supply_and_demand() %>% 
  shift_demand(outwards = TRUE) %>% 
  shift_supply(outwards = FALSE) %>% 
  plot_supply_and_demand(consumer_surplus = TRUE)

ggsupplyDemand has a default shifter for both the demand and supply. However, if you need something different, you can always change it:

create_supply_and_demand() %>% 
  shift_supply() %>% 
  shift_supply(shifter = 250) %>% 
  shift_demand(outwards = FALSE, shifter = 400) %>% 
  plot_supply_and_demand()



David-Salazar/ggsupplyDemand documentation built on May 8, 2019, 3:11 a.m.