Skip to content

Instantly share code, notes, and snippets.

A B C D
1 1 a 1
2 2 b 2
3 3 c 3
record time
a 12:30
b 1:45
c 2:15
@batpigandme
batpigandme / nicolson2002_notes.md
Created November 28, 2018 12:46
Notes from Nicolson, C., Starfield, A., Kofinas, G. et al. "Heuristics for Interdisciplinary Modelers." Ecosystems (2002) 5: 376. https://doi.org/10.1007/s10021-001-0081-5

From: Nicolson, C., Starfield, A., Kofinas, G. et al. "Heuristics for Interdisciplinary Modelers." Ecosystems (2002) 5: 376. https://doi.org/10.1007/s10021-001-0081-5

  • Heuristic 1. Know what skills to look for when recruiting an interdisciplinary team.
  • Heuristic 2. Invest strongly in problem definition early in the project.
  • Heuristic 3. Use rapid prototyping for all modeling efforts.
  • Heuristic 4. Allow the project’s focus to evolve by not allocating all funds up front.
  • Heuristic 5. Ban all models or model components that are inscrutable.
  • Heuristic 6. Instead of concentrating on one all-purpose synthesis model, invest in a suite of models, each with a well-defined objective.
  • Heuristic 7. Maintain a healthy balance between the well-understood and the poorly understood components of the system.
  • Heuristic 8. Sensitivity analysis is vital at all stages of the modeling effort.
@batpigandme
batpigandme / dk_positions_names.csv
Created November 28, 2018 12:36
DraftKings position eligibility as of 2018-11-28
position name roster_position pg sg sf pf c g f util
SF/PF LeBron James SF/PF/F/UTIL FALSE FALSE TRUE TRUE FALSE FALSE TRUE TRUE
SF/PF Kevin Durant SF/PF/F/UTIL FALSE FALSE TRUE TRUE FALSE FALSE TRUE TRUE
PG/SG Stephen Curry PG/SG/G/UTIL TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE
PG Damian Lillard PG/G/UTIL TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE
PG John Wall PG/G/UTIL TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE
C Nikola Vucevic C/UTIL FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE
SG/SF DeMar DeRozan SG/SF/F/G/UTIL FALSE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
C Hassan Whiteside C/UTIL FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE
PF/C LaMarcus Aldridge PF/C/F/UTIL FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE
@batpigandme
batpigandme / mapping_kiva_loans.R
Created November 23, 2018 16:24
Making a map of kiva loans with tmap
suppressPackageStartupMessages(library(tidyverse))
library(tmap)
data("World")
kiva_locations <- tibble::tribble(
~location, ~`number of loans`, ~pct_loans, ~iso_a3,
"Uganda", 25, 0.337837838, "UGA",
"Kenya", 8, 0.108108108, "KEN",
"Togo", 6, 0.081081081, "TGO",
"Rwanda", 5, 0.067567568, "RWA",
suppressPackageStartupMessages(library(tidyverse))
library(forcats)
# source: https://fossa.io/blog/which-open-source-license-is-the-best-for-commercialization/
os_licenses <- tibble::tribble(
~license, ~valuations_pct,
"MPLv2", 1.5,
"LGPL v2.1", 1.5,
"GPL v2", 49.4,
"AGPL v3", 3.4,
"Apache 2.0", 35.3,
@batpigandme
batpigandme / data_mask_tidy_eval.Rmd
Created November 15, 2018 22:59
Playing w/ data mask example from tidy eval cheatsheet
---
title: "Data mask stuff"
output: github_document
---
```{r include=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(
message = FALSE, warning = FALSE, echo = TRUE, fig.retina = 2, collapse = TRUE
)
```
sample_gls <- tibble::tribble(
                      ~name, ~team, ~mins, ~pts, ~rbs, ~ast, ~stl, ~blk,
  "Rondae Hollis-Jefferson", "BKN",    17,    7,    2,    0,    1,    0,
               "Joe Harris", "BKN",    30,    7,    3,    3,    0,    0,
             "Allen Crabbe", "BKN",    28,   14,    5,    2,    0,    0,
      "Dorian Finney-Smith", "DAL",    11,    3,    0,    0,    0,    0,
          "Wesley Matthews", "DAL",    36,   22,    7,    1,    1,    0,
              "Maxi Kleber", "DAL",    13,   11,    3,    0,    0,    0,
              "Jordan Bell", "GSW",    10,    2,    3,    1,    0,    1,
@batpigandme
batpigandme / reprex_dpasta_sample_n.R
Last active October 29, 2018 13:37
Using {datapasta} with {reprex} for sampled group data frames with dplyr::sample_n()
library(tidyverse)
# add data from gist script
# https://gist.github.com/batpigandme/daff0d8259f4086239ccf09da16ea5fd#file-yest_player_gls-r
# download csv from gist
# https://gist.github.com/batpigandme/daff0d8259f4086239ccf09da16ea5fd#file-yest_player_gls-csv
# or
# read in data from gist as csv
url <- "https://gist.githubusercontent.com/batpigandme/daff0d8259f4086239ccf09da16ea5fd/raw/df7d36be144e48af544e982eb22a7d0a1fe7534f/yest_player_gls.csv"
yest_player_gls <- readr::read_csv(url)
# data source: https://twitter.com/seanposting/status/1054136447362629637
wings <- tibble::tribble(
~count, ~item, ~price,
4, "Chicken Wings", 4.55,
5, "Chicken Wings", 5.7,
6, "Chicken Wings", 6.8,
7, "Chicken Wings", 7.95,
8, "Chicken Wings", 9.1,
9, "Chicken Wings", 10.2,
10, "Chicken Wings", 11.35,