[R] cat() and \r et al. escape sequences - are there more?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 22 15:11:52 CET 2015


See ?Quotes.

On 22/01/2015 13:32, Rainer M Krug wrote:
> Hi
>
> I just discovered \r and \t
>
> --8<---------------cut here---------------start------------->8---
>> cat(LETTERS, "\n")
> A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
>>
> --8<---------------cut here---------------end--------------->8---
>
> --8<---------------cut here---------------start------------->8---
>> cat(LETTERS, "\r", letters, "\n")
>   a b c d e f g h i j k l m n o p q r s t u v w x y z
>>
>> --8<---------------cut here---------------end--------------->8---
>
> and
> \a as alert
> \b as backspace
> \f as form-feed
> \n as newline
> \r as carriage-return
> \t as tab
> \v as vertical-tab
>
> are there more of these escape sequences?
>
> Especially, Can I position the cursor at a specific column? I would like
> to do this to show progress in an analysis done with mclapply() on
> multiple cores and, preferably, display each core (7) at a fixed
> position in a line.

How these are interpreted is a matter for the terminal/console. Some 
terminals have escape sequences to do that, but most consoles do not.

>
> Thanks,
>
> Rainer
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK



More information about the R-help mailing list