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(tibble) | |
library(ggplot2) | |
# Imagine a circle inscribed in a unit square | |
# We can converge (slowly) on the value of pi by throwing random darts | |
# at this target; counting how many fall in versus out of the circle; | |
# and using the resulting approximate area ratio to calculate pi. | |
set.seed(12345) |
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
# Makes the inset plot shown in https://twitter.com/BenBondLamberty/status/1483560012844838922?s=20 | |
set.seed(21) | |
n <- 750 | |
x <- data.frame(x = runif(n)) | |
for(vn in 1:70) { | |
x[paste0("v", vn)] <- runif(n) | |
} |