calc_streak <- function(x){
y <- rep(0,length(x))
y[x == "H"] <- 1
y <- c(0, y, 0)
wz <- which(y == 0)
streak <- diff(wz) - 1
return(streak)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.