Reputation: 113
Sometimes I perform long lasting calculations in the loop. To get control of the progress I print current value of the loop variable. However it makes my console flooded with numbers. I would like to move back cursor to the begining of console line after each printing. This would end with the last value of the variable only. That would be similar to command without on line printer. Any idea on how to achieve that in R console?
Upvotes: 0
Views: 406
Reputation: 8572
as b2f correctly mentions in the comment use \r
as in the example below
cat('hello world\rMinor')
Minor world
One thing to note though is that every command is assigned a new line in an interactive setting, so in interactive code this only works as part of a single command.
Upvotes: 3