[Rd] cat with backspace and newline characters

Yihui Xie xie at yihui.name
Wed Nov 6 00:32:35 CET 2013


Yes, that indeed sounds like a problem, but example(txtProgressBar),
which is based on \r, works well in the RStudio console. Anyway,
thanks for all the experiments, and (to Renaud) support.rstudio.org is
the place to report such problems.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Tue, Nov 5, 2013 at 4:57 PM, peter dalgaard <pdalgd at gmail.com> wrote:
>
>
> So in a sense, it is the prompt that is tweaked to “jump to beginning of next line, unless already at beginning of line”. I don’t recall any “real” terminal having an escape sequence for that, but I wouldn’t put it past ESS to do something similar.
>
> I see your point about cat(“pi”, pi), but I would expect that the bad habit would get cured first time it was attempted to print something between it and the next prompt. I’m actually more worried/puzzled that “\r” behaves strangely (in Rstudio, not R.app):
>
>> cat("123");cat("\r456")
> 456
>> cat("123\r");cat("456")
> 123456
>
> People do sometimes use this pattern for displaying progress (e.g. iteration counts).
>



More information about the R-devel mailing list