How to improve the analysis in the console

advertisements

How can write an R code for console output of the progress of my analysis?

I have the following code for looping over several folders:

for (f in folder.paths){
cmd....
}

I want the following message to be outputted in the console: "Running folder Sky1...."

Thanks


Similar to Fernando's answer, but here everything stays on the same line:

for(i in 1:10) {
  cat("\rWorking on", i)
  Sys.sleep(1)
}

Try it out.