Hi, What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying to capture the whole R console into a text file when my code fails. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA fws.gov/redbluff/rbdd_jsmp.aspx [[alternative HTML version deleted]]
HI, I guess ?sink() may not work for you as you need? the whole R console. Have you tried library(TeachingDemos) ?txtStart(), ?txtStop() ? txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) <codes> txtStop() A.K. ----- Original Message ----- From: Felipe Carrillo <mazatlanmexico at yahoo.com> To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch> Cc: Sent: Sunday, December 16, 2012 8:30 PM Subject: [R] save to file ?Hi, What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying to capture the whole R console into a text file when my code fails. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA fws.gov/redbluff/rbdd_jsmp.aspx ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Hi, This is what I did: library(TeachingDemos) ?txtStart("foo1.txt",commands=TRUE,results=TRUE,append=FALSE) Output being copied to text file, use txtStop to end txt> ave(dta$Range,dta$Lat1,FUN=mean) ?[1] 616.440 714.360 616.440 690.770 714.360 714.360 690.770 766.155 851.550 [10] 851.550 766.155 txt> txtStop() #Output in "foo1.txt"> ave(dta$Range, dta$Lat1, FUN = mean)?[1] 616.440 714.360 616.440 690.770 714.360 714.360 690.770 766.155 851.550 [10] 851.550 766.155 A.K. ________________________________ From: Felipe Carrillo <mazatlanmexico at yahoo.com> To: arun <smartpink111 at yahoo.com> Sent: Sunday, December 16, 2012 9:28 PM Subject: Re: [R] save to file My text file is created but its empty. Did you start library(TeachingDemos) txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) on you R.profile to capture the R statement? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA fws.gov/redbluff/rbdd_jsmp.aspx From: arun <smartpink111 at yahoo.com>>To: Felipe Carrillo <mazatlanmexico at yahoo.com> >Sent: Sunday, December 16, 2012 6:16 PM >Subject: Re: [R] save to file > > > >Hi, >If there are comments in your code, you need to ?txtComment() from library(TeachingDemos).? I did a trial run and was able to get the snapshot in the output file. > >A.K. > > >________________________________ >From: Felipe Carrillo<mazatlanmexico at yahoo.com>>To: arun <smartpink111 at yahoo.com> >Sent: Sunday, December 16, 2012 9:13 PM >Subject: Re: [R] save to file > > >I know about sink() and capture.output() but these functions don't capture the entire console. I basically >want a snapshot of all the text on the R console saved to a file. I am the users to send me the file so that I can >see where the R crashed. I will check the Teaching Demos. Thanks > >Felipe D. Carrillo >Supervisory Fishery Biologist >Department of the Interior >US Fish & Wildlife Service >California, USA >fws.gov/redbluff/rbdd_jsmp.aspx > > > >From: arun <smartpink111 at yahoo.com> >>To: Felipe Carrillo <mazatlanmexico at yahoo.com> >>Cc: R help <r-help at r-project.org> >>Sent: Sunday, December 16, 2012 6:07 PM >>Subject: Re: [R] save to file >> >>HI, >> >>I guess ?sink() may not work for you as you need? the whole R console. >> >>Have you tried library(TeachingDemos) ?txtStart(), ?txtStop() >? >> >>txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) >><codes> >>txtStop() >> >>A.K. >> >> >> >>----- Original Message ----- >>From: Felipe Carrillo <mazatlanmexico at yahoo.com> >>To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch> >>Cc: >>Sent: Sunday, December 16, 2012 8:30 PM >>Subject: [R] save to file >> >>?Hi, >>What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying >>to capture the whole R console into a text file when my code fails. >> >> >> >> >>Felipe D. Carrillo >>Supervisory Fishery Biologist >>Department of the Interior >>US Fish & Wildlife Service >>California, >USA >>fws.gov/redbluff/rbdd_jsmp.aspx >> >>???[[alternative HTML version deleted]]>> >> >>______________________________________________ >>R-help at r-project.org mailing list >>stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code. >> >> >> >>? > > >?
I did check that link but it doesn't do what I want..thanks for trying though. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA fws.gov/redbluff/rbdd_jsmp.aspx From: arun <smartpink111@yahoo.com>>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >Sent: Sunday, December 16, 2012 6:55 PM >Subject: Re: [R] save to file > >Hi, >sink() gives only the output to be saved in the "foo.txt", but txtStart(), txtStop() gets the codes and the output. Sorry, I misunderstood your question. > >You can also check this link (if you haven't already seen) >r.789695.n4.nabble.com/Capturing-R-console-output-into-a-file-sink-savehistory-td2227013.html >A.K. > > > > > >________________________________ >From: Felipe Carrillo <mazatlanmexico@yahoo.com> >To: arun <smartpink111@yahoo.com> >Sent: Sunday, December 16, 2012 9:47 PM >Subject: Re: [R] save to file > > >What you did That's what sink() does but I mean the entire R console screen including the R statement below >I just want to be able to capture everything during the R session > >R version 2.15.0 (2012-03-30) >Copyright (C) 2012 The R Foundation for Statistical Computing >ISBN 3-900051-07-0 >Platform: i386-pc-mingw32/i386 (32-bit) >R is free software and comes with ABSOLUTELY NO WARRANTY. >You are welcome to redistribute it under certain conditions. >Type 'license()' or 'licence()' for distribution details. > Natural language support but running in an English locale >R is a collaborative project with many contributors. >Type 'contributors()' for more information and >'citation()' on how to cite R or R packages in publications. >Type 'demo()' for some demos, 'help()' for on-line help, or >'help.start()' for an HTML browser interface to help. >Type 'q()' to quit R. > >Felipe D. Carrillo >Supervisory Fishery Biologist >Department of the Interior >US Fish & Wildlife Service >California, USA >fws.gov/redbluff/rbdd_jsmp.aspx > > > >From: arun <smartpink111@yahoo.com> >>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >>Sent: Sunday, December 16, 2012 6:37 PM >>Subject: Re: [R] save to file >> >>Hi, >>I am using Ubuntu 12.04. >> >>My sessionInfo() if that helps: >>sessionInfo() >>R version 2.15.0 (2012-03-30) >>Platform: x86_64-pc-linux-gnu (64-bit) >> >>locale: >> [1] LC_CTYPE=en_US.UTF-8 >LC_NUMERIC=C >> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 >> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 >> [7] LC_PAPER=C LC_NAME=C >> [9] LC_ADDRESS=C LC_TELEPHONE=C >>[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >> >>attached base packages: >>[1] stats graphics grDevices utils datasets >methods base >> >>other attached packages: >>[1] TeachingDemos_2.8 stringr_0.6 reshape_0.8.4 plyr_1.7.1 >> >>loaded via a namespace (and not attached): >>[1] tcltk_2.15.0 tools_2.15.0 >>A.K. >> >> >> >> >> >> >> >>________________________________ >>From: Felipe Carrillo <mazatlanmexico@yahoo.com> >>To: arun <smartpink111@yahoo.com> >>Sent: Sunday, December 16, 2012 9:28 PM >>Subject: Re: [R] save to file >> >> >>My text file is created but its empty. Did you start >>library(TeachingDemos) >>txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) >>on you R.profile to capture the R statement? >> >>Felipe D. >Carrillo >>Supervisory Fishery Biologist >>Department of the Interior >>US Fish & Wildlife Service >>California, USA >>fws.gov/redbluff/rbdd_jsmp.aspx >> >> >> >>From: arun <smartpink111@yahoo.com> >>>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >>>Sent: Sunday, December 16, 2012 6:16 PM >>>Subject: Re: [R] save to file >>> >>> >>> >>>Hi, >>>If there are comments in your code, you need to ?txtComment() from library(TeachingDemos). I did a trial run and was able to get the snapshot in the output file. >>> >>>A.K. >>> >>> >>>________________________________ >>>From: Felipe Carrillo >><mazatlanmexico@yahoo.com> >>>To: arun <smartpink111@yahoo.com> >>>Sent: Sunday, December 16, 2012 9:13 PM >>>Subject: Re: [R] save to file >>> >>> >>>I know about sink() and capture.output() but these functions don't capture the entire console. I basically >>>want a snapshot of all the text on the R console saved to a file. I am the users to send me the file so that I can >>>see where the R crashed. I will check the Teaching Demos. Thanks >>> >>>Felipe D. Carrillo >>>Supervisory Fishery Biologist >>>Department of the Interior >>>US Fish & Wildlife Service >>>California, USA >>>fws.gov/redbluff/rbdd_jsmp.aspx >>> >>> >>> >>>From: arun <smartpink111@yahoo.com> >>>>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >>>>Cc: R help <r-help@r-project.org> >>>>Sent: Sunday, December 16, 2012 6:07 PM >>>>Subject: Re: [R] save to file >>>> >>>>HI, >>>> >>>>I guess ?sink() may not work for you as you need the whole R console. >>>> >>>>Have you tried library(TeachingDemos) ?txtStart(), ?txtStop() >>>? >>>> >>>>txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) >>>><codes> >>>>txtStop() >>>> >>>>A.K. >>>> >>>> >>>> >>>>----- Original Message ----- >>>>From: Felipe >Carrillo <mazatlanmexico@yahoo.com> >>>>To: "r-help@stat.math.ethz.ch" <r-help@stat.math.ethz.ch> >>>>Cc: >>>>Sent: Sunday, December 16, 2012 8:30 PM >>>>Subject: [R] save to file >>>> >>>> Hi, >>>>What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying >>>>to capture the whole R console into a text file when my code fails. >>>> >>>> >>>> >>>> >>>>Felipe D. Carrillo >>>>Supervisory Fishery Biologist >>>>Department of the Interior >>>>US Fish & Wildlife Service >>>>California, >>>USA >>>>fws.gov/redbluff/rbdd_jsmp.aspx >>>> >>>> >>[[alternative HTML version deleted]] >>>> >>>> >>>>______________________________________________ >>>>R-help@r-project.org mailing list >>>>stat.ethz.ch/mailman/listinfo/r-help >>>>PLEASE do read the posting guide R-project.org/posting-guide.html >>>>and provide commented, minimal, self-contained, reproducible code. >>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > >[[alternative HTML version deleted]]
Well, I am going to give copies of an application to different offices and want to be able to generate an output file in the event that an error would ocurr while running the different R routines. By saving the entire R console along with the R version, I should be able to see where the error ocurred. I've seen text files with every single text from the R console but can't find the way to capture that. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA fws.gov/redbluff/rbdd_jsmp.aspx From: arun <smartpink111@yahoo.com>>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >Sent: Sunday, December 16, 2012 7:13 PM >Subject: Re: [R] save to file > >As a workaround, you could copy manually the R statements "R version 2.15.0 (2012-03-30)--- >Type 'q()' to quit R." and then use txtStart()..txtStop(). Would it work? The reason I am saying is that with 1000s of lines of code, this will be still easier. >A.K. > > > > > > >________________________________ >From: Felipe Carrillo <mazatlanmexico@yahoo.com> >To: arun <smartpink111@yahoo.com>; "r-help@stat.math.ethz.ch" <r-help@stat.math.ethz.ch> >Sent: Sunday, December 16, 2012 10:03 PM >Subject: Re: [R] save to file > > >I did check that link but it doesn't do what I want..thanks for trying though. > > >Felipe D. Carrillo >Supervisory Fishery Biologist >Department of the Interior >US Fish & Wildlife Service >California, USA >fws.gov/redbluff/rbdd_jsmp.aspx > > > >From: arun <smartpink111@yahoo.com> >>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >>Sent: Sunday, December 16, 2012 6:55 PM >>Subject: Re: [R] save to file >> >>Hi, >>sink() gives only the output to be saved in the "foo.txt", but txtStart(), txtStop() gets the codes and the output. Sorry, I misunderstood your question. >> >>You can also check this link (if you haven't already >seen) >>r.789695.n4.nabble.com/Capturing-R-console-output-into-a-file-sink-savehistory-td2227013.html >>A.K. >> >> >> >> >> >>________________________________ >>From: Felipe Carrillo <mazatlanmexico@yahoo.com> >>To: arun <smartpink111@yahoo.com> >>Sent: Sunday, December 16, 2012 9:47 PM >>Subject: Re: [R] save to file >> >> >>What you did That's what sink() does but I mean the entire R console screen including the R statement below >>I just want to be able to capture everything during the R session >> >>R version 2.15.0 (2012-03-30) >>Copyright (C) 2012 The R Foundation for Statistical Computing >>ISBN 3-900051-07-0 >>Platform: i386-pc-mingw32/i386 (32-bit) >>R is free software and comes with ABSOLUTELY NO WARRANTY. >>You are welcome >to redistribute it under certain conditions. >>Type 'license()' or 'licence()' for distribution details. >> Natural language support but running in an English locale >>R is a collaborative project with many contributors. >>Type 'contributors()' for more information and >>'citation()' on how to cite R or R packages in publications. >>Type 'demo()' for some demos, 'help()' for on-line help, or >>'help.start()' for an HTML browser interface to help. >>Type 'q()' to quit R. >> >>Felipe D. Carrillo >>Supervisory Fishery Biologist >>Department of the Interior >>US Fish & Wildlife Service >>California, USA >>fws.gov/redbluff/rbdd_jsmp.aspx >> >> >> >>From: arun <smartpink111@yahoo.com> >>>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >>>Sent: Sunday, December 16, 2012 6:37 PM >>>Subject: Re: [R] save to file >>> >>>Hi, >>>I am using Ubuntu 12.04. >>> >>>My sessionInfo() if that helps: >>>sessionInfo() >>>R version 2.15.0 (2012-03-30) >>>Platform: x86_64-pc-linux-gnu (64-bit) >>> >>>locale: >>> [1] LC_CTYPE=en_US.UTF-8 >>LC_NUMERIC=C >>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 >>> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 >>> [7] LC_PAPER=C LC_NAME=C >>> [9] >LC_ADDRESS=C LC_TELEPHONE=C >>>[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >>> >>>attached base packages: >>>[1] stats graphics grDevices utils datasets >>methods base >>> >>>other attached packages: >>>[1] TeachingDemos_2.8 stringr_0.6 reshape_0.8.4 plyr_1.7.1 >>> >>>loaded via a namespace (and not attached): >>>[1] tcltk_2.15.0 tools_2.15.0 >>>A.K. >>> >>> >>> >>> >>> >>> >>> >>>________________________________ >>>From: Felipe Carrillo <mazatlanmexico@yahoo.com> >>>To: arun <smartpink111@yahoo.com> >>>Sent: Sunday, December 16, 2012 9:28 PM >>>Subject: Re: [R] save to file >>> >>> >>>My text file is created but its empty. Did you start >>>library(TeachingDemos) >>>txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) >>>on you R.profile to capture the R statement? >>> >>>Felipe D. >>Carrillo >>>Supervisory Fishery Biologist >>>Department of the Interior >>>US Fish & Wildlife Service >>>California, USA >>>fws.gov/redbluff/rbdd_jsmp.aspx >>> >>> >>> >>>From: arun <smartpink111@yahoo.com> >>>>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >>>>Sent: Sunday, December 16, 2012 6:16 PM >>>>Subject: Re: [R] save to file >>>> >>>> >>>> >>>>Hi, >>>>If there are comments in your code, you need to ?txtComment() from library(TeachingDemos). I did a trial run and was able to get the snapshot in the output file. >>>> >>>>A.K. >>>> >>>> >>>>________________________________ >>>>From: Felipe Carrillo >>><mazatlanmexico@yahoo.com> >>>>To: arun <smartpink111@yahoo.com> >>>>Sent: Sunday, >December 16, 2012 9:13 PM >>>>Subject: Re: [R] save to file >>>> >>>> >>>>I know about sink() and capture.output() but these functions don't capture the entire console. I basically >>>>want a snapshot of all the text on the R console saved to a file. I am the users to send me the file so that I can >>>>see where the R crashed. I will check the Teaching Demos. Thanks >>>> >>>>Felipe D. Carrillo >>>>Supervisory Fishery Biologist >>>>Department of the Interior >>>>US Fish & Wildlife Service >>>>California, USA >>>>fws.gov/redbluff/rbdd_jsmp.aspx >>>> >>>> >>>> >>>>From: arun <smartpink111@yahoo.com> >>>>>To: Felipe Carrillo <mazatlanmexico@yahoo.com> >>>>>Cc: R help <r-help@r-project.org> >>>>>Sent: Sunday, December 16, 2012 6:07 PM >>>>>Subject: Re: [R] save to file >>>>> >>>>>HI, >>>>> >>>>>I guess ?sink() may not work for you as you need the whole R console. >>>>> >>>>>Have you tried library(TeachingDemos) ?txtStart(), ?txtStop() >>>>? >>>>> >>>>>txtStart("foo.txt",commands=TRUE,results=TRUE,append=FALSE) >>>>><codes> >>>>>txtStop() >>>>> >>>>>A.K. >>>>> >>>>> >>>>> >>>>>----- Original Message ----- >>>>>From: Felipe >>Carrillo <mazatlanmexico@yahoo.com> >>>>>To: "r-help@stat.math.ethz.ch" <r-help@stat.math.ethz.ch> >>>>>Cc: >>>>>Sent: Sunday, December 16, 2012 8:30 PM >>>>>Subject: [R] save to file >>>>> >>>>> Hi, >>>>>What's the equivalent of "Save to File" from the R console File menu on an R routine? Just trying >>>>>to capture the whole R console into a text file when my code fails. >>>>> >>>>> >>>>> >>>>> >>>>>Felipe D. Carrillo >>>>>Supervisory Fishery Biologist >>>>>Department of the Interior >>>>>US Fish & Wildlife >Service >>>>>California, >>>>USA >>>>>fws.gov/redbluff/rbdd_jsmp.aspx >>>>> >>>>> >>>[[alternative HTML version deleted]] >>>>> >>>>> >>>>>______________________________________________ >>>>>R-help@r-project.org mailing list >>>>>stat.ethz.ch/mailman/listinfo/r-help >>>>>PLEASE do read the posting guide R-project.org/posting-guide.html >>>>>and provide commented, minimal, self-contained, reproducible >code. >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > >[[alternative HTML version deleted]]
On Dec 16, 2012, at 7:35 PM, Felipe Carrillo wrote:> Well, I am going to give copies of an application to different offices and want to be able to generate an output file > in the event that an error would ocurr while running the different R routines. By saving the entire R console along with the > R version, I should be able to see where the error ocurred. I've seen text files with every single text from the R console but can't find > the way to capture that.Most consoles will accept cmd-A or similar to select all text in a console session. Figure out what that keystroke combo is for your OS and then ctl- or cmd-C and paste into text editor. -- David Winsemius Alameda, CA, USA