Git Product home page Git Product logo

chicken-wings's People

Contributors

jennybc avatar

Watchers

James Cloos avatar  avatar

chicken-wings's Issues

Session info!

mean(rnorm(100))
#> [1] -0.06011666

Created on 2018-11-30 by the reprex package (v0.2.1.9000)

Session info
devtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.5.1 (2018-07-02)
#>  os       macOS  10.14.1              
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_CA.UTF-8                 
#>  ctype    en_CA.UTF-8                 
#>  tz       America/Los_Angeles         
#>  date     2018-11-30                  
#> 
#> ─ Packages ──────────────────────────────────────────────────────────────
#>  package     * version    date       lib source                         
#>  assertthat    0.2.0      2017-04-11 [2] CRAN (R 3.5.0)                 
#>  backports     1.1.2      2017-12-13 [2] CRAN (R 3.5.0)                 
#>  base64enc     0.1-3      2015-07-28 [2] CRAN (R 3.5.0)                 
#>  callr         3.0.0.9001 2018-11-14 [1] Github (r-lib/callr@be7707d)   
#>  cli           1.0.1.9000 2018-11-14 [1] Github (r-lib/cli@56538e3)     
#>  crayon        1.3.4      2017-09-16 [2] CRAN (R 3.5.0)                 
#>  debugme       1.1.0      2017-10-22 [1] CRAN (R 3.5.0)                 
#>  desc          1.2.0      2018-11-14 [1] Github (r-lib/desc@7c12d36)    
#>  devtools      2.0.1      2018-10-26 [1] CRAN (R 3.5.1)                 
#>  digest        0.6.18     2018-10-10 [1] CRAN (R 3.5.0)                 
#>  evaluate      0.12       2018-10-09 [2] CRAN (R 3.5.0)                 
#>  fs            1.2.6      2018-08-23 [1] CRAN (R 3.5.0)                 
#>  glue          1.3.0      2018-07-17 [1] CRAN (R 3.5.0)                 
#>  htmltools     0.3.6      2017-04-28 [2] CRAN (R 3.5.0)                 
#>  knitr         1.20       2018-02-20 [2] CRAN (R 3.5.0)                 
#>  magrittr      1.5        2014-11-22 [2] CRAN (R 3.5.0)                 
#>  memoise       1.1.0.9000 2018-11-13 [1] Github (hadley/memoise@1650ad7)
#>  pkgbuild      1.0.2      2018-10-16 [1] CRAN (R 3.5.0)                 
#>  pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.5.0)                 
#>  prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.5.0)                 
#>  processx      3.2.0.9000 2018-11-14 [1] Github (r-lib/processx@8374340)
#>  ps            1.2.1      2018-11-06 [1] CRAN (R 3.5.1)                 
#>  R6            2.3.0      2018-10-04 [1] CRAN (R 3.5.0)                 
#>  Rcpp          1.0.0      2018-11-07 [1] CRAN (R 3.5.0)                 
#>  remotes       2.0.2.9000 2018-11-14 [1] Github (r-lib/remotes@e56a41e) 
#>  rlang         0.3.0.9000 2018-11-21 [1] Github (r-lib/rlang@1de51e4)   
#>  rmarkdown     1.10       2018-06-11 [1] CRAN (R 3.5.0)                 
#>  rprojroot     1.3-2      2018-01-03 [2] CRAN (R 3.5.0)                 
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.5.1)                 
#>  stringi       1.2.4      2018-07-20 [1] CRAN (R 3.5.0)                 
#>  stringr       1.3.1      2018-05-10 [2] CRAN (R 3.5.0)                 
#>  testthat      2.0.1      2018-10-13 [1] CRAN (R 3.5.0)                 
#>  usethis       1.4.0.9000 2018-10-27 [1] local                          
#>  withr         2.1.2      2018-03-15 [2] CRAN (R 3.5.0)                 
#>  yaml          2.2.0      2018-07-25 [2] CRAN (R 3.5.0)                 
#> 
#> [1] /Users/jenny/resources/R/library
#> [2] /Library/Frameworks/R.framework/Versions/3.5/Resources/library

reprex demo

library(tidyverse)

wings <- tribble(
  ~count, ~price,
  4,   4.55,
  5,    5.7,
  6,    6.8,
  7,   7.95,
  8,    9.1,
  9,   10.2,
  10,  11.35,
  11,   12.5,
  12,   13.6,
  13,  14.75,
  14,   15.9,
  15,     17,
  16,  18.15,
  17,   19.3,
  18,   20.4,
  19,  21.55,
  20,   22.7,
  21,   23.8,
  22,  24.95,
  23,   26.1,
  24,  27.25,
  25,   27.8,
  26,  28.95,
  27,   30.1,
  28,   31.2,
  29,  32.35,
  30,   33.5,
  35,  39.15,
  40,   44.8,
  45,   50.5,
  50,   55.6,
  60,     67,
  70,   78.3,
  75,  83.45,
  80,   89.1,
  90, 100.45,
  100, 111.25,
  125,    139,
  150, 166.85,
  200,  222.5
)
wings <- wings %>%
  mutate(
    wing_cost = price/count,
    marginal_wing_cost =
      (price - lag(price, default = 0)) / (count - lag(count, default = 0))
  )

# sanity check
ggplot(wings, aes(x = count, y = price)) +
  geom_point()

# cost per wing against total wings bought
# https://twitter.com/dataandme/status/1056343232735571969
ggplot(wings, aes(x = count, y = wing_cost)) +
  geom_path()

# marginal wing price
# https://twitter.com/alistaire/status/1056531627445231621
ggplot(wings, aes(x = count, y = marginal_wing_cost)) +
  geom_path()

Created on 2018-11-29 by the reprex package (v0.2.1.9000)

Look at my figure!

library(gapminder)
library(ggplot2)

ggplot(subset(gapminder, continent != "Oceania"),
       aes(x = year, y = lifeExp, group = country, color = country)) +
  geom_line(lwd = 1, show.legend = FALSE) + facet_wrap(~ continent) +
  scale_color_manual(values = country_colors) +
  theme_bw() + theme(strip.text = element_text(size = rel(1.1)))

Created on 2018-11-30 by the reprex package (v0.2.1.9000)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.