Created
November 11, 2015 21:37
-
-
Save jalapic/8c6c3fd87a039a093926 to your computer and use it in GitHub Desktop.
model output to word
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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