Function in running but knit to HTML does not work - sample function

This is my code:

mc_s_f <- function(N,s,f){
s <- c()
f <- c()
for (i in 1:N){
samp_s <- sample(s,1)
samp_f <- sample(f,1)
f_samp <- c(f_samp, samp_f)
if (samp_s>samp_f){
s<- c(s,1)}
}
s_prob <- sum(s)/N
return(s_prob)
}

The function is running and i can see output.

This is the error I get when I try to knit to HTML:

A post was merged into an existing topic: Code is running but Knit to HTML does not work

Please do not duplicate open topics