Hi, everyone: I forget on how to save a result from R as a word document. For example, if I run the linear regression and want to save the result: summary(lm(y~x) in a word file. So I can show it later to my clients. Any idea on how to do this? Thanks a lot, Suyan
I don't know any direct way. ?sink perhaps and then load into Word. You might want to have a look at R2HTML as well. Alternatively have a look at Sweave for output in pdf or OOo formats. --- On Thu, 7/2/09, Suyan Tian <stian at mail.rockefeller.edu> wrote:> From: Suyan Tian <stian at mail.rockefeller.edu> > Subject: [R] save the result into a word file > To: R-help at r-project.org > Received: Thursday, July 2, 2009, 1:26 PM > Hi, everyone: > > I forget on how to save a result from R as a word document. > For example, if I run the linear regression and want to save > the result: > > summary(lm(y~x) > > in a word file. So I can show it later to my clients.? > Any idea on how to do this? > > Thanks a lot, > > > Suyan > > ______________________________________________ > 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. >__________________________________________________________________ Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share wh
Some suggestions in increasing complexity: 1. Cut-and-paste from the R console. (Cut-and-paste has got to be the best computer invention ever.) 2. If you want to generate the output automatically from an unattended script, try help("cat") and help("file") 3. Try help("Sweave") for even more automated document production. Also package "odfWeave" and perhaps "R2HTML" 4. More Microsofty approaches are in packages c("R2PPT", "rcom") and also "WriteXLS". Personally, I like the first option. Allan. On 02/07/09 18:26, Suyan Tian wrote:> Hi, everyone: > > I forget on how to save a result from R as a word document. For > example, if I run the linear regression and want to save the result: > > summary(lm(y~x) > > in a word file. So I can show it later to my clients. Any idea on how > to do this? > > Thanks a lot, > > > Suyan > > ______________________________________________ > R-help@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.[[alternative HTML version deleted]]
Hello, On Fri, Jul 3, 2009 at 2:15 PM, Allan Engelhardt<allane at cybaea.com> wrote:> 1. Cut-and-paste from the R console. ?(Cut-and-paste has got to be the > best computer invention ever.) >First option is probably interesting when using in Word a monospace font for R results. For tables, you can also go via copy from R and paste in Excel (or OpenOffice Calc), and then switch the table to the word processor.> 2. If you want to generate the output automatically from an unattended > script, try help("cat") and help("file") > > 3. Try help("Sweave") for even more automated document production. ?Also > package "odfWeave" and perhaps "R2HTML" > >From the HTML options, you can also generate HTML code using xtable orHmisc::html(), and then import the formatted results in Word or Excel. Liviu
How about export it to a HTML and then copy to MS word. I have packaged some code to export lm object to HTML in AJS style. You can have a look at ASAtable (http://r-forge.r-project.org/R/?group_id=328). Ronggui 2009/7/3 Suyan Tian <stian at mail.rockefeller.edu>:> Hi, everyone: > > I forget on how to save a result from R as a word document. For example, if > I run the linear regression and want to save the result: > > summary(lm(y~x) > > in a word file. So I can show it later to my clients. ?Any idea on how to do > this? > > Thanks a lot, > > > Suyan > > ______________________________________________ > 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. >-- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html
One technique that I use a screen capture that you can paste into the document. This works nicely since it will also capture the color/size of the fonts. Works well for the graphics that you want to include. If you have MS OneNote, you can use this. There is a freeware package (MWSnap) that I also use that works fine. This also gives you a resizable image that you can make fit into your Word or PowerPoint document. On Fri, Jul 3, 2009 at 10:06 AM, Liviu Andronic<landronimirc at gmail.com> wrote:> Hello, > > On Fri, Jul 3, 2009 at 2:15 PM, Allan Engelhardt<allane at cybaea.com> wrote: >> 1. Cut-and-paste from the R console. ?(Cut-and-paste has got to be the >> best computer invention ever.) >> > First option is probably interesting when using in Word a monospace > font for R results. For tables, you can also go via copy from R and > paste in Excel (or OpenOffice Calc), and then switch the table to the > word processor. > > >> 2. If you want to generate the output automatically from an unattended >> script, try help("cat") and help("file") >> >> 3. Try help("Sweave") for even more automated document production. ?Also >> package "odfWeave" and perhaps "R2HTML" >> > >From the HTML options, you can also generate HTML code using xtable or > Hmisc::html(), and then import the formatted results in Word or Excel. > Liviu > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?