I have written a simulation in R that I want to visualize with shiny now. I have put the main part of the simulation into an observe block in order to be evaluated.
Since you have a Sys.sleep() call in your code, I'm assuming you only want to run through one iteration per second. If that's the case, you could set a reactiveTimer that will evaluate code every second. Inside that timer, you'd run the code for the current iteration then bump up the dummy$iter variable.