-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
You can programmatically create content directly in Word from R including tables, lists, paragraphs, etc. via a DCOM connection where R is the client and Word is the server. There are two packages to do this - rcom and RDCOMClient and both allow you to work at much higher levels of specificity than cutting and pasting HTML or CSV content. You'd have to learn a little about the DCOM API for Word, but there are examples. ~ D. [EMAIL PROTECTED] wrote: | # Dear list, | # I am an R-beginner and | # spent the last days looking for a method to insert tables produced | # with R into a word document. I thought about SPPS: copy a table from | # an SPO-file and paste it into a word document | # (if needed do some formatting with that table). | # Annother idea was, to produce a TEX-file, | # insert it and make it a word-table. | | # I found the following libraries, which seemed to be promising: | # xtable | # prettyR | # R2HTML | # Hmisc | # SciViews / svViews | | | | ####################################################################### | ## My example: a crosstable (made with CrossTable from lib gmodels #### | ####################################################################### | | library(gmodels) | library(xtable) | library(svViews) | | # Data for crosstabulation | set.seed(1) | n <- 200 | sex <- sample(c("f","m"),n,T) | state <- sample(c("AL","AK","CA"),n,T) | | #Create crosstab | ct <- CrossTable(state, sex, expected=TRUE, format="SPSS", digits=1) | ct #display crosstab on screen | | #Trie to produce a html file | xtable(ct) #Error message: No method! | methods(xtable) | | | | #Try to create a rich formatted table and insert it into Word | #with svViws, but only a little part of crosstab it inserted | | docdir <- "r:\\r" | WordOpen(file.path(docdir, "cross.doc")) | viewfile <- view(ct, type = "summary", browse = FALSE) | WordGoto("ctview") | WordInsertFile(viewfile, TRUE) #only a little part of crosstab inserted | WordActivate(async = TRUE) | | | #How could I create the latex-code for the crosstable? | w <- latex(ct) #would that work? | | # I could not test this, because I didn´t install Miktex yet | # (I will do this soon) | | Can someone help me? | | Thanks in advance | Udo | | | ------------------------------ | Udo Koenig | Clinic for child and adolescent psychiatry | University of Marburg / Germany | | ______________________________________________ | R-help@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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHuGsu9p/Jzwa2QP4RAn9xAJ94KmlBA5Yl1hfT4Z0CsmL7s61qpwCfZNhn BMaw4u4FggRWn3QrKg79PAw= =mElZ -----END PGP SIGNATURE----- ______________________________________________ R-help@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.