I am including some R code in Rmarkdown, and I am trying to suppress the progress bar inside a function.
Suppose I have the following function:
func <- function(n){
pb <- txtProgressBar(min = 1, max = n, style = 3)
for(i in 1:n){
Sys.sleep(0.1)
setTxtProgressBar(pb, i)
}
close(pb)
}
and I want to call the function in Rmarkdown like this:
```{r, message=FALSE, progress=FALSE}
func(10)
```
However, even if I set progress = FALSE, the progress bar still shows. Is there a way to suppress it?