I'm just wondering what is the best way in R to keep printing on the same line in a loop so as not to put out your console? Let them say to print a value indicating your progress, as in
for (i in 1:10) {print(i)}
Edit:
I tried inserting a carriage return before each value, as in
for (i in 1:10000) {cat("\r",i)}
but it also doesnโt quite work, as it will just update the value on the screen after the loop, just returning 10000 in this case .... Any thoughts?
NB this does not mean to make a progress bar, because I know that there are different functions for this, but just to be able to print some information during the progression of a cycle without dulling the console.
r printing
Tom wenseleers
source share