[R] Copying tables from R to Excel

Bos, Roger roger.bos at rothschild.com
Tue Sep 23 18:34:16 CEST 2014


Here is a simple method I saw mentioned on this list a few years ago:

toExcel <- function(x, tag=FALSE) {write.table(x, "clipboard-128", sep="\t", row.names=tag)}




***************************************************************
This message and any attachments are for the named person's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies. You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of David L Carlson
Sent: Tuesday, September 23, 2014 10:15 AM
To: ivan.calandra at univ-reims.fr; r-help at r-project.org
Subject: Re: [R] Copying tables from R to Excel

If you looked at the documentation for R2HTML you might have noticed that there is no function HTML.matrix. Perhaps your recommendation from an unnamed source is out of date? Assuming you loaded the package with library(R2HTML) as Ivan suggested, the command would be

HTML( summary(iris), file("clipboard", "w"), append=F )

Which will work just fine as long as you are using the Windows operating system. More technically, HTML() is a generic function with methods (156 in this case) for many different data types including matrices and tables.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Ivan Calandra
Sent: Tuesday, September 23, 2014 8:12 AM
To: r-help at r-project.org
Subject: Re: [R] Copying tables from R to Excel

library(R2HTML) ??

Le 23/09/14 15:04, Angel Rodriguez a écrit :
> Dear Subscribers,
>
> I've found this recommendation to paste an R table to Excel:
>
> HTML.matrix( summary(iris), file("clipboard", "w"), append=F )
>     # paste into Excel
>
> After installing R2HTML and writting that command, I get:
>
> Error: could not find function "HTML.matrix"
>
> Any clue?
>
> Thank you very much,
>
> Angel Rodr�guez-Laso
>
>       [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> 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.

______________________________________________
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.
______________________________________________
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.


More information about the R-help mailing list