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

Rainer M Krug r.m.krug at gmail.com
Thu Jan 22 16:07:46 CET 2015



Envoyé de mon iPhone

> Le 22 janv. 2015 à 15:29, Prof Brian Ripley <ripley at stats.ox.ac.uk> a écrit :
> 
>> On 22/01/2015 14:22, Rainer M Krug wrote:
>> 
>> 
>> Envoyé de mon iPhone
>> 
>>> Le 22 janv. 2015 à 15:11, Prof Brian Ripley <ripley at stats.ox.ac.uk> a écrit :
>>> 
>>> See ?Quotes.
>> 
>> Perfect - thanks.
>> 
>>> 
>>>> 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.
>> 
>> You don't know by any chance if terminal on Yosemite has these?
> 
> Depends what terminal you set it to emulate, but likely yes.  See e.g. http://www.termsys.demon.co.uk/vtansi.htm 

Thanks - exactly the information I was looking for. 

I'll give feedback if I get it to work. 

Thanks,

Rainer

> 
>> 
>> Thanks,
>> 
>> Rainer
>> 
>>> 
>>>> 
>>>> 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
> 
> 
> -- 
> 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