Skip to content

Instantly share code, notes, and snippets.

@jalapic
Created November 11, 2015 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalapic/8c6c3fd87a039a093926 to your computer and use it in GitHub Desktop.
Save jalapic/8c6c3fd87a039a093926 to your computer and use it in GitHub Desktop.
model output to word
### Getting model output into Word (if you really have to)
# This assumes that in your working directory you already have a word document called rtf.doc
library(rtf) # puts data into RTF format
fit <- summary(lm(mpg ~ cyl + hp, data=mtcars))
coeffs <- as.data.frame(round(coef(fit), 2))
rtffile <- RTF("rtf.doc") # this can be an .rtf or a .doc
addParagraph(rtffile, "This is the output of a regression coefficients:\n")
addTable(rtffile, coeffs)
done(rtffile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment