Hi! I am currently struggling to make this code of mine into an ongoing loop. Here is my code:
for (pi in seq(0,1,0.1)) {
x <- seq(0,10,by=1)
y <- dbinom(1, x,pi)
barplot(y,xlim=c(0,10),ylim=c(0,1), col = blue)
Sys.sleep(1)
print(y)
}
I need to create a GIF (or animation) of a binomial distribution that loops on forever. The animation must display a histogram with the bars going up and down as n changes.