Grec001
Grec001

Reputation: 1121

Can the console stop rolling up when sending cat or print?

Is it possible to cat or print specific message at same place without keeping scolling up?

A <- proc.time()[3]

for (i in 1:1e3) {
  B <- proc.time()[3]
  system("sleep, 60")

  Time_Mark <- round(B - A, 2)
  cat(paste("time passed", Time_Mark, "\n"))
}

Upvotes: 0

Views: 48

Answers (1)

vlsd
vlsd

Reputation: 945

You can try replacing \n with \r and see if that does it. The reason it might work is that \r is a pure carriage return (without going to a new line) and depending on your system it will be interpreted as such. Slightly more info here https://en.wikipedia.org/wiki/Carriage_return

Upvotes: 1

Related Questions