I am trying to create an (ascii) progress wheel that runs while any random function runs.
For example, the sf packages st_intersection()
runs painfully slow and I would like an indicator showing that R is still working.
It should look something like this:
while (T) {
for(c in c("-", "\\", "|", "/")){
Sys.sleep(0.1)
cat("\r", c)
}
}
I can't figure out how to make this run while the "target"-function is progressing. Also putting the system to sleep is not exactly helpful for runtimes. My first idea was to let the wheel run while R is busy but I couldn't figure out how to do it (although it is possible as is evident by the "stop" button used to interrupt a running script).
I found a few answers for Shiny packages but nothing (easily) adaptable to base R.