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
rcau <- function() { | |
angle <- 2 * pi * runif(1) | |
radius <- 1 * (runif(1) ^ (1/2)) | |
x <- radius * cos(angle) | |
y <- radius * sin(angle) | |
c(x, y) | |
} |
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(reshape2) | |
library(ggplot2) | |
df <- melt(volcano[20:44,10:34]) | |
names(df) <- c("x","y","val") | |
rect <- data.frame(st = 5, en = 20) | |
ggplot() + |
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
pearson_residuals <- function(counts, theta = 100) { | |
counts_sum0 <- as(matrix(Matrix::colSums(counts),nrow=1),"dgCMatrix") | |
counts_sum1 <- as(matrix(Matrix::rowSums(counts),ncol=1),"dgCMatrix") | |
counts_sum <- sum(counts@x) | |
#get residuals | |
mu <- (counts_sum1 %*% counts_sum0) / counts_sum | |
z <- (counts - mu) / sqrt(mu + mu^2/theta) | |
#clip to sqrt(n) |
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(rgl) | |
sl <- shapelist3d(cube3d(alpha = 1, | |
color = 'grey90', | |
specular = 'black', | |
lit = TRUE), | |
plot = FALSE) | |
create_next_level <- function(sl, level) { | |
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
season | episode | director | writer | staff_writer | |
---|---|---|---|---|---|
01 | 01 | Ken Kwapis | Ricky Gervais;Stephen Merchant;Greg Daniels | ||
01 | 02 | Ken Kwapis | B.J. Novak | Mindy Kaling | |
01 | 03 | Ken Whittingham | Paul Lieberstein | Mindy Kaling | |
01 | 04 | Bryan Gordon | Michael Schur | Mindy Kaling | |
01 | 05 | Greg Daniels | Greg Daniels | Mindy Kaling | |
01 | 06 | Amy Heckerling | Mindy Kaling | Mindy Kaling | |
02 | 01 | Greg Daniels | Mindy Kaling | ||
02 | 02 | Ken Kwapis | B.J. Novak | ||
02 | 03 | Paul Feig | Michael Schur |
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
buffer | percent_acrylamide | kDa_size | percent_migration | |
---|---|---|---|---|
MES | 8 | 260 | 12 | |
MES | 8 | 160 | 22 | |
MES | 8 | 110 | 30 | |
MES | 8 | 80 | 35 | |
MES | 8 | 60 | 40 | |
MES | 8 | 50 | 45 | |
MES | 8 | 40 | 55 | |
MES | 8 | 30 | 60 | |
MES | 8 | 20 | 70 |
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
# Tidyeval notes | |
library(dplyr) | |
library(rlang) | |
library(tasic2016data) | |
# one character element: | |
test <- "primary_type_id" | |
expr_test <- parse_expr(test) |
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
plot_logo <- function() { | |
library(ggplot2) | |
core_rect <- data.frame(xmin = 0, | |
xmax = 4, | |
ymin = 0, | |
ymax = 0.6, | |
color = "") | |
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(cocoframer) | |
library(purrr) | |
library(rgl) | |
structures <- c("root","CA") | |
mesh_list <- map(structures, ccf_2017_mesh) | |
names(mesh_list) <- structures | |
plot_ccf_meshes(mesh_list, |
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(purrr) | |
library(magrittr) | |
library(microbenchmark) | |
y_test <- sample(0:9, 2000, replace = TRUE) | |
pred1 <- sample(0:9, 2000, replace= TRUE) | |
pred2 <- sample(0:9, 2000, replace= TRUE) | |
preds <- list(pred1, pred2) | |
# want to apply the following to preds |
NewerOlder