[R] Page eject and clearing the console

David Winsemius dwinsemius at comcast.net
Tue Jan 4 19:55:27 CET 2011


On Jan 4, 2011, at 1:27 PM, David Winsemius wrote:

>
> On Jan 4, 2011, at 1:19 PM, John Sorkin wrote:
>
>> I have received help on one of my questions (thank you Henrique Jorge
>> and ), viz. how I can clear the console from an R program.
>> I have not yet received help on how I can skip to the top of the next
>> page, i.e. cat("\n") skips to the next line, is there an equivalent  
>> way
>> to skip to the top of the next page?
>
> "\n" does NOT "skip to the next line". It is a character and it is  
> interpreted by some sort of program, say a a plotting program or a  
> word-processor as a line feed. You need to specify what sort of  
> program you intend to do this "skipping-to-next-page" action and  
> also provide the character sequence that that program uses to signal  
> that action. (There are not any pages in R except perhaps multi-page  
> plots but you seem to be in character mode at the moment.)
>

It has occurred to me that you may be asking for something that will  
give the illusion of "clearing the screen" but will in fact be just  
"printing" a page of blank space on a console display, scrolling would  
ahve been the name I would have given it. In which case:

scroll <- function(lines=40) cat(rep("\n", lines))
scroll()

> -- 
> David.
>
>
>> Thanks,
>> John
>>
>>
>>
>>
>> John David Sorkin M.D., Ph.D.
>> Chief, Biostatistics and Informatics
>> University of Maryland School of Medicine Division of Gerontology
>> Baltimore VA Medical Center
>> 10 North Greene Street
>> GRECC (BT/18/GR)
>> Baltimore, MD 21201-1524
>> (Phone) 410-605-7119
>> (Fax) 410-605-7913 (Please call phone number above prior to  
>> faxing)>>>
>> Henrique Dallazuanna <wwwhsd at gmail.com> 1/4/2011 11:58 AM >>>
>> Take a look on:
>> http://tolstoy.newcastle.edu.au/R/e11/help/10/09/8463.html
>>
>> On Tue, Jan 4, 2011 at 2:54 PM, John Sorkin
>> <jsorkin at grecc.umaryland.edu>wrote:
>>
>>> (1) I know that \n when used in cat, e.g. cat("\n") produces a line
>> feed
>>> (i.e. skips to the next line). Is there any escape sequence that  
>>> will
>> go to
>>> the top of the next page?
>>> (2) I know that control L will clear the console. Is there an
>> equivalent
>>> function or other means that can be used in R code to clear the
>> console?
>>>
>>> Thanks,
>>> John
>>>
>>>
>>> John David Sorkin M.D., Ph.D.
>>> Chief, Biostatistics and Informatics
>>> University of Maryland School of Medicine Division of Gerontology
>>> Baltimore VA Medical Center
>>> 10 North Greene Street
>>> GRECC (BT/18/GR)
>>> Baltimore, MD 21201-1524
>>> (Phone) 410-605-7119
>>> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>>>
>>> Confidentiality Statement:
>>> This email message, including any attachments, is for\...{{dropped: 
>>> 25}}
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list