[R] pasting results into Word/Excel
Gabor Grothendieck
ggrothendieck at myway.com
Sun Apr 11 21:28:56 CEST 2004
Gabor Grothendieck <ggrothendieck <at> myway.com> writes:
>
> Graham M Smith <graham.smith <at> myotis.co.uk> writes:
>
> : Is there some clever way of pasting results from R into Excel or Word, as
> : tab limited format so they are easy to turn into a formatted table.
>
> Try this:
>
> data(iris) # get a test data frame
> require(R2HTML)
> HTML( iris, file("clipboard","w"), append=F )
>
> Now go to Excel and press ctrl-V to paste it in.
> Once its in Excel you can copy and paste from there to Word.
I noticed that your response to other respondents indicate that you
want to display a summary. Try something like this with the above
approach:
HTML.matrix( summary(iris), file("clipboard", "w"), append=F )
# paste into Excel
In Excel, with the table selected, you may wish to
- set the cell width (Format | Column | Width) wider, say 12, and
- right justify the matrix (click on right justify icon in toolbar)
More information about the R-help
mailing list