How to save table1 package output table to .doc format? R

enter image description here

Package "table1" allows for some amazing tables to be made. However, i can't figure how to export one to .doc format. Here is an example code: table1( ~ x | Y, data = df) I wonder if it is possible to somehow save resulting table into .doc format so it still looks like this:

asked Mar 23, 2020 at 14:32 656 1 1 gold badge 6 6 silver badges 20 20 bronze badges

5 Answers 5

Turns out it's very simple:

Just cmd+a the table in Rstudio viewer -> cmd+c -> paste Special in MS Word -> chose .html format!

answered Mar 24, 2020 at 9:52 656 1 1 gold badge 6 6 silver badges 20 20 bronze badges

I'm sorry to dig this up. However I learnt to love the two packages table1 and aswell flextable and one other route would be to fastly convert the table1 object to a flextable

library(table1) library(flextable) library(magrittr) # Create Table1 Object tbl1% save_as_docx(path="Iris_table1.docx") 

Note that this give you the full flexibility over working with a flextable and an easy and save way to export to word. A nice guide on additional formatting with flextable can be found here