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
I0324 16:41:21.750172 24757 out.go:239] Setting OutFile to fd 1 ... | |
I0324 16:41:21.752574 24757 out.go:291] isatty.IsTerminal(1) = true | |
I0324 16:41:21.752613 24757 out.go:252] Setting ErrFile to fd 2... | |
I0324 16:41:21.752619 24757 out.go:291] isatty.IsTerminal(2) = true | |
I0324 16:41:21.752712 24757 root.go:308] Updating PATH: /Users/orrymr/.minikube/bin | |
I0324 16:41:21.753937 24757 out.go:246] Setting JSON to false | |
I0324 16:41:21.793920 24757 start.go:108] hostinfo: {"hostname":"Orrys-MacBook-Pro.local","uptime":256360,"bootTime":1616340521,"procs":522,"os":"darwin","platform":"darwin","platformFamily":"Standalone Workstation","platformVersion":"11.0.1","kernelVersion":"20.1.0","kernelArch":"x86_64","virtualizationSystem":"","virtualizationRole":"","hostId":"d8523129-e878-38ba-a8e0-1d0e8d2470b7"} | |
W0324 16:41:21.794100 24757 start.go:116] gopshost.Virtualization returned error: not implemented yet | |
I0324 16:41:21.814198 24757 out.go:129] 😄 minikube v1.18.1 on Darwin 11.0.1 | |
😄 minikube v1.18.1 o |
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
mean_value <- sum(seq(1:6) * (1 / 6)) | |
print(mean_value) | |
# [1] 3.5 |
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
row1 <- c(2, 3, 4, 5, 6, 7) / 2 | |
row2 <- c(3, 4, 5, 6, 7, 8) / 2 | |
row3 <- c(4, 5, 6, 7, 8, 9) / 2 | |
row4 <- c(5, 6, 7, 8, 9, 10) / 2 | |
row5 <- c(6, 7, 8, 9, 10, 11) / 2 | |
row6 <- c(7, 8, 9, 10, 11, 12) / 2 | |
dice <- matrix(c(row1, row2, row3, row4, row5, row6), nrow = 6, byrow = TRUE) | |
dice |
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
number_of_rolls <- 1000000 # Or, we could manually roll a die 1 million times. Nah, let's let the computer do it. | |
mean(sample(1:6, number_of_rolls, replace = TRUE)) | |
# [1] 3.499435 |
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
#roll, as in roll di(c)e | |
# m = number of times | |
# n = number of dice | |
roll <- function(m, n){ | |
set.seed(1234) | |
means <- plyr::ldply(1:m, function(x){ | |
return(mean(sample(1:6, n, replace = 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
n_ <- 1 | |
m_ <- 10000 | |
g <- ggplot(roll(m = m_, n = n_), | |
mapping = aes(x = V1)) + | |
geom_vline(xintercept = 3.5, colour = "tomato3") + | |
labs( | |
subtitle = str_interp('Density of means of dice | |
rolls for ${n_} dice over ${m_} rolls.'), | |
x = 'Mean Score', |
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
g <- g + | |
geom_density() | |
g |
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
n_ <- 2 | |
m_ <- 10000 | |
g <- ggplot(roll(m = m_, n = n_), | |
mapping = aes(x = V1)) + | |
geom_vline(xintercept = 3.5, colour = "tomato3") + | |
labs( | |
subtitle = str_interp('Density of means of dice | |
rolls for ${n_} dice over ${m_} rolls.'), | |
x = 'Mean Score', |
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
n_ <- 4 | |
m_ <- 10000 | |
g <- ggplot(roll(m = m_, n = n_), | |
mapping = aes(x = V1)) + | |
geom_vline(xintercept = 3.5, colour = "tomato3") + | |
labs( | |
subtitle = str_interp('Density of means of dice | |
rolls for ${n_} dice over ${m_} rolls.'), | |
x = 'Mean Score', |
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
n_ <- 20 | |
m_ <- 10000 | |
g <- ggplot(roll(m = m_, n = n_), | |
mapping = aes(x = V1)) + | |
geom_vline(xintercept = 3.5, colour = "tomato3") + | |
labs( | |
subtitle = str_interp('Density of means of dice | |
rolls for ${n_} dice over ${m_} rolls.'), | |
x = 'Mean Score', |
OlderNewer