From: Tom Backer Johnsen <backer_at_psych.uib.no>

Date: Sat 11 Feb 2006 - 06:45:44 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Feb 11 06:49:51 2006

Date: Sat 11 Feb 2006 - 06:45:44 EST

The steps involved are really quite simple, the information is transferred via a speadsheet:

The last two steps are the same as when using Statistica or SPSS in a anyhow. Especially SPSS has a tendency include too much formatting when pasting, and then Excel is a useful stepping stone to strip off the frills.

The main difference is in the first step. What we need there is to write the output from R to the clipboard in a format that Excel recognizes as something with columns and rows. For an example, consider the "summary ()" output from the multiple regression in part 7.4 above.

First, you have to make the library "R2HTML" available to the session:

> library (R2HTML)

You only need to do this once in a session. If this package is not installed, have a look at part 9 above. Then we need to attach the data set and do the multiple regression:

* > attach (attitude)
** > Results <- lm (rating ~ complaints + privileges + learning)
*

> HTML (summary (Results, digits=4), file("clipboard", "w"), append=FALSE)

> detach (attitude)

If you do this more than a few times, it might be a good idea to write a function as a replacement for the HTML command with a reasonable name, e.g. "ToClip". The last command could then be replaced by:

> ToClip (summary (Results, digits=4))

Which is much simpler. In any case, the results are now writtten to the clipboard. Open Excel, and paste the contents into a worksheet. Select what you want, copy it to the clipboard, and then open your document where the paper is found. Locate the place where you want the table, and paste the clipboard there. </QUOTE>

After showing how the table looks, I mention that some details will have to be fixed, like conversion of the lower part of the output to text, removing blank rows, adding borders etc., plus rewriting the p value which is in scientific notation. It is still not in an APA format, but very much better than it would bave been with a simple "copy and past" operation.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Feb 11 06:49:51 2006

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:42:27 EST
*