[R] pasting results into Word/Excel

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Apr 11 17:11:29 CEST 2004


Graham M Smith wrote:
> 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.
> 
> Or is there some other way of doing this to avoid the time spent 
> reformatting the output for presentation.

To copy/paste your data.frame X to Excel, use the following lines to 
write it to the clipboard from R:

    con <- file("clipboard", open="w")
    write.table(x, file=con, sep="\t", row.names=FALSE, col.names=FALSE)
    close(con)

(you might want to define a wrapper function around it ...)




> If different, I am also interested in an answer to the same question but 
> using S-Plus.

What about copying from its spreadsheet?

Uwe Ligges



> Many thanks,
> 
> Graham
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list