save to file

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

save to file

Felipe Carrillo
 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
http://www.fws.gov/redbluff/rbdd_jsmp.aspx

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

arun kirshna
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 <[hidden email]>
To: "[hidden email]" <[hidden email]>
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
http://www.fws.gov/redbluff/rbdd_jsmp.aspx

    [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

arun kirshna


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 <[hidden email]>
To: arun <[hidden email]>
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
http://www.fws.gov/redbluff/rbdd_jsmp.aspx



From: arun <[hidden email]>

>To: Felipe Carrillo <[hidden email]>
>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
<[hidden email]>

>To: arun <[hidden email]>
>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
>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>
>
>
>From: arun <[hidden email]>
>>To: Felipe Carrillo <[hidden email]>
>>Cc: R help <[hidden email]>
>>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 <[hidden email]>
>>To: "[hidden email]" <[hidden email]>
>>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
>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>
>>   
[[alternative HTML version deleted]]

>>
>>
>>______________________________________________
>>[hidden email] 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.
>>
>>
>>
>> 
>
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

Felipe Carrillo
In reply to this post by Felipe Carrillo
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
http://www.fws.gov/redbluff/rbdd_jsmp.aspx


From: arun <[hidden email]>

>To: Felipe Carrillo <[hidden email]>
>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)
>http://r.789695.n4.nabble.com/Capturing-R-console-output-into-a-file-sink-savehistory-td2227013.html
>A.K. 
>
>
>
>
>
>________________________________
>From: Felipe Carrillo <[hidden email]>
>To: arun <[hidden email]>
>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
>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>
>
>
>From: arun <[hidden email]>
>>To: Felipe Carrillo <[hidden email]>
>>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 <[hidden email]>
>>To: arun <[hidden email]>
>>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
>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>
>>
>>
>>From: arun <[hidden email]>
>>>To: Felipe Carrillo <[hidden email]>
>>>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
>><[hidden email]>
>>>To: arun <[hidden email]>
>>>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
>>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>
>>>
>>>
>>>From: arun <[hidden email]>
>>>>To: Felipe Carrillo <[hidden email]>
>>>>Cc: R help <[hidden email]>
>>>>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 <[hidden email]>
>>>>To: "[hidden email]" <[hidden email]>
>>>>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
>>>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>>
>>>>   
>>[[alternative HTML version deleted]]
>>>>
>>>>
>>>>______________________________________________
>>>>[hidden email] 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.
>>>>
>>>>
>>>>
>>>> 
>>>
>>>
>>> 
>>
>>
>>  
>
>
>
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

Vivek Singh
On 17/12/2012 11:03, Felipe Carrillo wrote:

> 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
> http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>
>
> From: arun <[hidden email]>
>> To: Felipe Carrillo <[hidden email]>
>> 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)
>> http://r.789695.n4.nabble.com/Capturing-R-console-output-into-a-file-sink-savehistory-td2227013.html
>> A.K.
>>
>>
>>
>>
>>
>> ________________________________
>> From: Felipe Carrillo <[hidden email]>
>> To: arun <[hidden email]>
>> 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
>> http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>
>>
>>
>> From: arun <[hidden email]>
>>> To: Felipe Carrillo <[hidden email]>
>>> 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 <[hidden email]>
>>> To: arun <[hidden email]>
>>> 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
>>> http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>
>>>
>>>
>>> From: arun <[hidden email]>
>>>> To: Felipe Carrillo <[hidden email]>
>>>> 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
>>> <[hidden email]>
>>>> To: arun <[hidden email]>
>>>> 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
>>>> http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>>
>>>>
>>>>
>>>> From: arun <[hidden email]>
>>>>> To: Felipe Carrillo <[hidden email]>
>>>>> Cc: R help <[hidden email]>
>>>>> 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 <[hidden email]>
>>>>> To: "[hidden email]" <[hidden email]>
>>>>> 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
>>>>> http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>>>
>>>>>    
>>> [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] 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.
>>>>>
>>>>>
>>>>>
>>>>>  
>>>>
>>>>  
>>>
>>>    
>>
>>
> [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> [hidden email] 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.
one workaround could be to use a 'tee' in case of linux/unix.

Example: ssh username@R-server |tee log.txt

so this could save your entire session in the log.txt file.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

Felipe Carrillo
In reply to this post by Felipe Carrillo
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
http://www.fws.gov/redbluff/rbdd_jsmp.aspx


From: arun <[hidden email]>

>To: Felipe Carrillo <[hidden email]>
>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 <[hidden email]>
>To: arun <[hidden email]>; "[hidden email]" <[hidden email]>
>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
>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>
>
>
>From: arun <[hidden email]>
>>To: Felipe Carrillo <[hidden email]>
>>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)
>>http://r.789695.n4.nabble.com/Capturing-R-console-output-into-a-file-sink-savehistory-td2227013.html
>>A.K. 
>>
>>
>>
>>
>>
>>________________________________
>>From: Felipe Carrillo <[hidden email]>
>>To: arun <[hidden email]>
>>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
>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>
>>
>>
>>From: arun <[hidden email]>
>>>To: Felipe Carrillo <[hidden email]>
>>>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 <[hidden email]>
>>>To: arun <[hidden email]>
>>>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
>>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>
>>>
>>>
>>>From: arun <[hidden email]>
>>>>To: Felipe Carrillo <[hidden email]>
>>>>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
>>><[hidden email]>
>>>>To: arun <[hidden email]>
>>>>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
>>>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>>
>>>>
>>>>
>>>>From: arun <[hidden email]>
>>>>>To: Felipe Carrillo <[hidden email]>
>>>>>Cc: R help <[hidden email]>
>>>>>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 <[hidden email]>
>>>>>To: "[hidden email]" <[hidden email]>
>>>>>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
>>>>>http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>>>>>
>>>>>   
>>>[[alternative HTML version deleted]]
>>>>>
>>>>>
>>>>>______________________________________________
>>>>>[hidden email] 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.
>>>>>
>>>>>
>>>>>
>>>>> 
>>>>
>>>>
>>>> 
>>>
>>>
>>>  
>>
>>
>> 
>
>
>
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

David Winsemius

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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

Vivek Singh
try the following. it works for linux:

$ R|tee log.txt

I stored the log for a small period.

*R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-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.

> q()
Save workspace image? [y/n/c]: n*


On Mon, Dec 17, 2012 at 3:23 PM, David Winsemius <[hidden email]>wrote:

>
> 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
>
> ______________________________________________
> [hidden email] 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.
>



--
Thanks and Regards,

Vivek Kumar Singh

Alcatel-Lucent,
Bangalore

(91)9886317184, 8123951698

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save to file

Felipe Carrillo
I actually got it to do what I want running my R routine through a batch file. It saves to a file everything on the console. Thanks for
your suggestions.

Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx



>________________________________
>From: Vivek Singh <[hidden email]>
>To: David Winsemius <[hidden email]>
>Cc: Felipe Carrillo <[hidden email]>; r-help help <[hidden email]>
>Sent: Sunday, December 16, 2012 11:35 PM
>Subject: Re: [R] save to file
>
>
>try the following. it works for linux:
>
>$ R|tee log.txt
>
>I stored the log for a small period.
>
>R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
>Copyright (C) 2012 The R Foundation for Statistical Computing
>ISBN 3-900051-07-0
>Platform: x86_64-pc-linux-gnu (64-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.
>
>> q()
>Save workspace image? [y/n/c]: n
>
>
>
>On Mon, Dec 17, 2012 at 3:23 PM, David Winsemius <[hidden email]> wrote:
>
>
>>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
>>
>>
>>______________________________________________
>>[hidden email] 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.
>>
>
>
>--
>
>Thanks and Regards,
>
>Vivek Kumar Singh
>
>Alcatel-Lucent,
>Bangalore
>
>(91)9886317184, 8123951698
>
>
>
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.