[Rd] cat with backspace and newline characters

Martin Maechler maechler at stat.math.ethz.ch
Tue Nov 5 14:50:04 CET 2013


>>>>> Brian G Peterson <brian at braverock.com>
>>>>>     on Tue, 5 Nov 2013 07:30:14 -0600 writes:

    > On 11/05/2013 07:22 AM, Martin Maechler wrote:
    >> which --- as you allude to below --- shows that RStudio
    >> has changed R in so far that it adds a '\n' even when R,
    >> i.e.  cat() does not.
    >> 
    >> I can understand that the RStudio programmers want to
    >> protect their users (*) from getting funny looking
    >> output, but I still don't like the fact that R inside
    >> RStudio is tweaked to behave differently from regular R.

    > No, it just suggests exactly what Prof. Ripley alluded
    > to...

    > ... the output of cat() will be dependent on the display
    > terminal.

    > RStudio doesn't include R at all, and in fact makes use of
    > the/any R binary installed via other processes.  It is not
    > 'tweaked'.

    > It *does* include a 'terminal' to display the interactions
    > with the R console.

Well I know that (it does not modify R),
but I'd say that the above is just another way to say what I said:
RStudio tweaks R's output. I agree that this is much much less
problematic than changing R objects, but I'd claim that
where as the interpretation of  \b  depends on the
terminal/console (and so it is quite rarely used),
the functioning of  \n  should not depend on the platform.
RStudio users may conclude that it is a good idea to use things like
	cat("pi:", pi)
whereas they really should use something like
	cat("pi:", pi, "\n)

Martin

    > Regards,
    > Brian



More information about the R-devel mailing list