[R] Transferring results from R to MS Word
Tom Backer Johnsen
backer at psych.uib.no
Sat Oct 25 15:57:07 CEST 2008
Frank E Harrell Jr wrote:
> Tom Backer Johnsen wrote:
>> Greg Snow wrote:
>>> You may want to try the odfWeave package. It uses openoffice which
>>> can read and write MSWord documents. This is an alternative to the
>>> HTML > Excel > Word route.
>> Now that is an interesting alternative. Not for this term though, to
>> get the students to learn R and at the same time to change word
>> processor would be far from optimal.
> Several years ago I had new students learning S and LaTeX at the same
> time, using a LaTeX server to produce pdf so they didn't have to install
> LaTeX. It was 3 weeks of hell then they did fine.
Yes, I have been thinking along those lines myself, but I have not had
the courage to do so, at least not yet. The students are in what may be
called a "School of psychology" (somewhat like medicine), the majority
are girls with few ambitions toward using computers or science, in other
words they have a distinctly "soft" orientation. The teaching of
research methods and basic statistics for that kind of audience really
is a challenge.
The reason why I want to have larger accuracy is as follows: The
students have a type home exam, I handed out the questions yesterday,
and if they want to pass, they have to submit their response on
Thursday. In addition they all received a unique data set in the mail,
I have written a small program that generates a 50% random subset of a
master data set and mails the data set to each student. I can then run
a script file in R which will generate what each student should get with
his or her data set on all questions. The purpose is of course to make
it somewhat tricky for the students to directly copy between themselves,
and my checking is easier if there are more decimals.
>>> Gregory (Greg) L. Snow Ph.D.
>>> Statistical Data Center
>>> Intermountain Healthcare
>>> greg.snow at imail.org
>>>> -----Original Message-----
>>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>>>> project.org] On Behalf Of Tom Backer Johnsen
>>>> Sent: Friday, October 24, 2008 1:31 PM
>>>> To: r-help at stat.math.ethz.ch
>>>> Subject: [R] Transferring results from R to MS Word
>>>> At the moment I am teaching a course on the use of R for data analysis.
>>>> Part of course requirements involves the transfer of results from R
>>>> something that resembles the APA (American Psychological Associations)
>>>> type tables to MS Word. Until now I have used the HTML function in the
>>>> R2HTML library, with a call like this:
>>>> HTML(summary(model1), file("clipboard", "w"), digits=4)
>>>> Where "model1" is an object containing results from a linear model
>>>> (function lm ()). I have to add that I do not remember where I got the
>>>> digits argument from. The main point is that the output is transferred
>>>> to Excel as the first step where the output can be deleted and shuffled
>>>> in order to produce a correctly formatted table according to APA
>>>> standards which then is transferred to MS Word with a copy and paste
>>>> The problem is simply that what is tranferred to Excel varies with what
>>>> you throw at the HTML function. Nothing is rounded of with an lm()
>>>> model. With a function like sd () I seem to consistently get 2 decimal
>>>> points transferred, less than what I want, while there are variations
>>>> respect to the number of decimals when I transfer the result on the
>>>> summary () using a frame as the argument.
>>>> The optimal thing for me (and the students) would be to consistently
>>>> have all the decimals tranferred to Excel, any rounding to could be
>>>> there before the transfer of the table to MS Word. Alternatively, that
>>>> something like the argument digits=x works in a consistent manner with
>>>> at least most objects.
>>>> What do I tell my students on what to do using R2HTML in order to
>>>> consistent results?
>>>> Alternativly: are there other alternatives I and my students could use
>>>> for the transfer of results from R via Excel to MS Word?
>>>> I really would appreciate some suggestions.
| Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology |
| University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY |
| Tel : +47-5558-9185 Fax : +47-5558-9879 |
| Email : backer at psych.uib.no URL : http://www.galton.uib.no/ |
More information about the R-help