Hi, I would like to export all my workspace (even with the evaluation of commands) to the text file. I know about the sink() function but it doesnt work as I would like. My R-function looks like this: there are instructions for user displayed by cat() command and browser() commands for fulfilling them. While using the sink() command the instructions dont display :( Can anyone help me with a equivalent command to File - Save to file... option? Thank you very much. -- View this message in context: http://r.789695.n4.nabble.com/Export-to-txt-tp3965699p3965699.html Sent from the R help mailing list archive at Nabble.com.
On Tue, 1 Nov 2011, stat.kk wrote:> I would like to export all my workspace (even with the evaluation of > commands) to the text file.Have you looked at .Rhistory? If you save your workspace when you quit a session with R it's put in that file. You can always read it anywhere you have a text editor. When I end work with more processing to be done, but it's repeating what I did in the current session, I open a second buffer in emacs, load .Rhistory, and use that to continue processing. This may do what you want. Rich
I'm somewhat confused on how you intend to use browser() after rerouting output to a sink.... Beyond that, how are you running your script? source() has some arguments that encourage it to "say" alot more to the sink() command. Michael On Tue, Nov 1, 2011 at 6:15 PM, stat.kk <stat.kk at gmail.com> wrote:> Hi, > > I would like to export all my workspace (even with the evaluation of > commands) to the text file. I know about the sink() function but it doesnt > work as I would like. My R-function looks like this: there are instructions > for user displayed by cat() command and browser() commands for fulfilling > them. While using the sink() command the instructions dont display :( > Can anyone help me with a equivalent command to File - Save to file... > option? > > Thank you very much. > > -- > View this message in context: http://r.789695.n4.nabble.com/Export-to-txt-tp3965699p3965699.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >
Look at the txtStart function in the TeachingDemos package. It works like sink but also includes commands as well as output. Though I have never tried it with browser() (and it does not always include the results of errors). Another option in to use some type of editor that links with R such as emacs/ESS or tinn-R (or other) and then save the entire transcript. -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of stat.kk Sent: Tuesday, November 01, 2011 4:15 PM To: r-help at r-project.org Subject: [R] Export to .txt Hi, I would like to export all my workspace (even with the evaluation of commands) to the text file. I know about the sink() function but it doesnt work as I would like. My R-function looks like this: there are instructions for user displayed by cat() command and browser() commands for fulfilling them. While using the sink() command the instructions dont display :( Can anyone help me with a equivalent command to File - Save to file... option? Thank you very much. -- View this message in context: http://r.789695.n4.nabble.com/Export-to-txt-tp3965699p3965699.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.