9/12/2020

The Project

This project is the final project from Developing Data Products course and the main objective is to write a Shiny application.

Here it was built an application simulating the probability of a ten-faced die rolled n times.

How to include R code embedded on a slide

The following code calculates the probability of a ten-faced die rolled n times.

set.seed(1986)
n <- 5000
die <- 1:10
vec.n <- n
sum.n <- n
 r <- 1
for(i in 1:vec.n){
      vec.n[i] <- roll <- sample(die, size = 1, replace = TRUE)
      sum.n[i] <- sum(vec.n[1:i]==r)/i
}

Probability when n = 10000

Code Repository