This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| #Standard normal | |
| df = data.frame(x = seq(-3.5, 3.5, .01)) %>% | |
| mutate(y = dnorm(x)) | |
| p = ggplot(df, aes(x, y)) | |
| p = p + theme_bw() + | |
| theme( | |
| axis.title.y = element_blank(), | |
| axis.text.y = element_blank(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| df=data.frame(x=seq(-3.5,3.5,.01)) | |
| df = df %>% mutate(y=dnorm(x,sd=1)) | |
| p = ggplot(df,aes(x,y)) | |
| p = p + theme_bw() + | |
| theme(axis.title.y=element_blank(), | |
| axis.text.y=element_blank(), | |
| panel.grid.minor.x = element_blank()) + | |
| labs(x="Standard Deviations") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| #Wind speeds from the percentile bands in | |
| #https://weatherspark.com/y/23912/Average-Weather-in-New-York-City-New-York-United-States-Year-Round | |
| #https://weatherspark.com/y/14091/Average-Weather-in-Chicago-Illinois-United-States-Year-Round | |
| #weather.gov wind chill chart at https://www.weather.gov/safety/cold-wind-chill-chart | |
| get_wind_chill = function(temp,wind){ | |
| 35.74 + .6251*temp - 35.75 * wind^.16 + .4275 * temp * wind^.16 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| CELSIUS = FALSE | |
| heat_index16term = function(T, RH) { | |
| retval = 16.923 + 1.85212 * 1e-1 * T + 5.37941 * RH - 1.00254 * 1e-1 * T * | |
| RH + | |
| 9.41695 * 1e-3 * T ^ 2 + 7.28898 * 1e-3 * RH ^ 2 + 3.45372 * 1e-4 * | |
| T ^ 2 * RH - 8.14971 * 1e-4 * T * RH ^ 2 + | |
| 1.02102 * 1e-5 * T ^ 2 * RH ^ 2 - 3.8646 * 1e-5 * T ^ 3 + 2.91583 * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| setwd("C:/Dropbox/Projects/20180822_heat_index16term") | |
| heat_index16term = function(T, RH) { | |
| retval = 16.923 + 1.85212 * 1e-1 * T + 5.37941 * RH - 1.00254 * 1e-1 * T * | |
| RH + | |
| 9.41695 * 1e-3 * T ^ 2 + 7.28898 * 1e-3 * RH ^ 2 + 3.45372 * 1e-4 * | |
| T ^ 2 * RH - 8.14971 * 1e-4 * T * RH ^ 2 + | |
| 1.02102 * 1e-5 * T ^ 2 * RH ^ 2 - 3.8646 * 1e-5 * T ^ 3 + 2.91583 * | |
| 1e-5 * RH ^ 3 + 1.42721 * 1e-6 * T ^ 3 * RH + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #code by Ashton Anderson | |
| library(tidyverse) | |
| theme_set(theme_minimal()) | |
| mt <- read.csv(url('https://gist.githubusercontent.com/ashtonanderson/cfbf51e08747f60472ee2132b0d35efb/raw/80acd2ad7c0fba4e85c053e61e9e5457137e00ee/moveno_piecetype_counts')) | |
| mt <- mt %>% | |
| group_by(move_number) %>% | |
| mutate(tot = sum(count),frac = count/tot) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| theme_set(theme_bw()) | |
| STEPS = 251 | |
| ITER = 5000 | |
| #Function to get the change to X and Y corresponding | |
| #to each die roll | |
| get_offset = function(roll) | |
| { | |
| nx = ny = NA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(stringr) | |
| library(ggplot2) | |
| library(dplyr) | |
| library(scales) | |
| library(markovchain) | |
| MAXSTREAKLEN=16 | |
| #H/T https://math.stackexchange.com/questions/383704/probability-of-streaks for this soln | |
| get_prob = function(streaklen,sequencelen) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "Rain Per Day, Month, and Rainy Day in New York City" | |
| author: "Dan Goldstein" | |
| date: "August 26, 2017" | |
| output: | |
| html_document: default | |
| pdf_document: default | |
| word_document: default | |
| --- | |
| ```{r setup, include=FALSE} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(weatherData) | |
| library(viridis) | |
| library(lubridate) | |
| library(maps) | |
| library(ggmap) | |
| retList = vector('list', 10) | |
| for (i in 2:6) { | |
| retList[[i]] = |
NewerOlder