library(tidyverse)
library(mgcv)
#> Loading required package: nlme
#>
#> Attaching package: 'nlme'
#> The following object is masked from 'package:dplyr':
#>
#> collapse
#> This is mgcv 1.8-41. For overview type 'help("mgcv-package")'.
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(duckdb) | |
library(duckplyr) | |
library(dplyr) | |
chrome_history_path <- "./chrome_history.sqlite" | |
# Copy the db to the local directory because Chrome puts a lock on it | |
file.copy( | |
"~/.config/google-chrome/Default/History", # Adjust based on OS | |
chrome_history_path, |
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
#You have 3 urns, each containing 100 balls. | |
#In the first two, 99 of the balls are red and the last is green. | |
#In the third urn, all 100 balls are red. | |
#You choose one of the urns at random and remove 99 randomly chosen balls from it; they’re all red. | |
#The last is probably? | |
library(tidyverse) | |
pick_ball <- function(){ |
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
## following https://alistaire.rbind.io/blog/fireworks/ | |
## but manually convert to polar coordinates to be able to add | |
## background image, which cannot be used with coord_polar() | |
library(ggplot2) | |
library(gganimate) | |
theme_set(theme_void()) | |
## create set of points in polar coordinates | |
set.seed(0) |
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(MASS) | |
library(patchwork) | |
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") | |
# generate data with given cor matrix | |
a <- 0.9 | |
s1 <- matrix(c(1,a, | |
a,1), ncol = 2) |
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) | |
# Genuine confounding example. Sex confounds relationship between drug and death | |
set.seed(0) | |
n <- 1000000 | |
is_male <- rbinom(n, 1, 0.5) | |
drug <- rbinom(n, 1, 0.6 + 0.3*is_male) | |
y <- rbinom(n, 1, 0.4 - 0.1*drug + 0.4*is_male) | |
d <- tibble(drug, is_male, y) |
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: Animate transition from PCA <--> tsne | |
#' --- | |
# idea from: https://jef.works/genomic-data-visualization-2024/blog/2024/03/06/akwok1/ | |
#' ## Load packages and data | |
library(ggplot2) | |
library(gganimate) | |
library(Rtsne) | |
library(patchwork) |
I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.
I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:
NewerOlder