library("ReporteRs")
fake_data <- data.frame("Variable 1" = rnorm(5), "Variable 2" = rnorm(5),
"Variable 3" = rnorm(5), "Variable 4" = rnorm(5))
# Create a word document
doc <- docx(template="empty_table.docx")
# Add table
doc <- addFlexTable(doc, vanilla.table(fake_data))
# Write the word document to a file
writeDoc(doc, file="example.docx")