This file contains 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(lubridate) | |
questions <- readr::read_csv("~/Repositories/stacklite/questions.csv.gz") | |
question_tags <- readr::read_csv("~/Repositories/stacklite/question_tags.csv.gz") | |
r_questions <- question_tags %>% | |
filter(Tag == "r") | |
r_questions_by_month <- questions %>% |
This file contains 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
# randomly select min_n_plates from each strain | |
randomly_sampled_dataframe <- x %>% | |
dplyr::group_by_(grouping_var, plate_var, sample_var) %>% | |
tidyr::nest(.key = id_data) %>% | |
dplyr::group_by_(grouping_var, plate_var) %>% | |
dplyr::sample_n(min_n_id_per_plate) %>% | |
tidyr::nest(.key = plate_data) %>% | |
dplyr::group_by_(grouping_var) %>% | |
dplyr::sample_n(min_n_plates_per_strain) %>% | |
tidyr::unnest() %>% |
This file contains 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(ggplot2) | |
library(igraph) | |
library(ggraph) | |
library(scales) | |
library(ggforce) | |
network_theme <- theme_no_axes() + | |
theme(panel.border = element_blank()) | |
theme_set(network_theme) |
This file contains 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
Type | RouteName | Percent | |
---|---|---|---|
Unregistered | Questions/Show | 0.96941 | |
Unregistered | Home/Index | 0.00723 | |
Unregistered | Questions/ListByTag | 0.00532 | |
Unregistered | UsersShow/Show | 0.00298 | |
Established (1000-19,999) | Home/Index | 0.11612 | |
Established (1000-19,999) | Questions/ListByTag | 0.06254 | |
Established (1000-19,999) | Questions/Show | 0.65319 | |
Established (1000-19,999) | UsersShow/Show | 0.08317 | |
Registered (< 1000) | Home/Index | 0.02911 |
This file contains 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(broom) | |
library(scales) | |
theme_set(theme_minimal()) | |
crossing(n = round(10 ^ seq(1, 7, .1)), | |
delta = 10 ^ seq(-1, -3, -1), | |
sig.level = .05, | |
sd = .3) %>% | |
invoke(power.t.test, ., type = "one.sample") %>% |
This file contains 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(readr) | |
library(dplyr) | |
library(ggplot2) | |
faces <- read_csv("faces.csv") | |
vase <- bind_rows(select(faces, x = x1, y), | |
select(faces, x = x2, y) %>% arrange(y)) | |
faces %>% |
We can't make this file beautiful and searchable because it's too large.
This file contains 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
Year,Month,Questions,Tag,MonthTotal,TagTotal | |
2008,8,4,.htaccess,3929,57155 | |
2008,9,12,.htaccess,14543,57155 | |
2008,10,10,.htaccess,14951,57155 | |
2008,11,16,.htaccess,12967,57155 | |
2008,12,12,.htaccess,12324,57155 | |
2009,1,24,.htaccess,16152,57155 | |
2009,2,35,.htaccess,17889,57155 | |
2009,3,43,.htaccess,20785,57155 | |
2009,4,46,.htaccess,21701,57155 |
This file contains 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) | |
# Data is downloaded from here: | |
# https://www.kaggle.com/c/digit-recognizer | |
kaggle_data <- read_csv("~/Downloads/train.csv") | |
pixels_gathered <- kaggle_data %>% | |
mutate(instance = row_number()) %>% | |
gather(pixel, value, -label, -instance) %>% | |
extract(pixel, "pixel", "(\\d+)", convert = TRUE) |
This file contains 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: "R Notebook" | |
output: html_notebook | |
--- | |
```{r} | |
library(purrr) | |
transition_mc <- function(steps, start, mat) { | |
i <- seq_len(nrow(mat)) |
This file contains 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(purrr) | |
transition_mc <- function(steps, start, mat) { | |
i <- seq_len(nrow(mat)) | |
transition <- ~ sample(i, 1, prob = (i == .) %*% mat) | |
accumulate(seq_len(steps), transition, .init = start) | |
} |