(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 th...{{dropped:6}}
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@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:20}}
Hi John, I don't understand what you mean by "top of the next page", or rather, how that differs from clearing the screen. And for the latter, that is dependent on OS, and on GUI/console usage, and has been discussed several times on the list. The easiest solution is to invoke the system command if running in a console. For linux, that would be: system("clear") A Google search using the exact words from your question found several more options, including a discussion of doing this in Windows. http://www.google.com/search?q=R+code+to+clear+the+console I can't test them for you, but since I don't know if you're using Windows or not it may not matter. Sarah On Tue, Jan 4, 2011 at 11:54 AM, 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 >-- Sarah Goslee http://www.functionaldiversity.org
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? 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 linefeed> (i.e. skips to the next line). Is there any escape sequence that willgo to> the top of the next page? > (2) I know that control L will clear the console. Is there anequivalent> function or other means that can be used in R code to clear theconsole?> > 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}}
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.) -- 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
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