Is there a way to easily turn a data frame into a Word table via rmarkdown?
If I use rmarkdown in RStudio to create a Word document I get a nicely printed table but
Here is a very low-tech (and fast) way to do it
source("http://michael.hahsler.net/SMU/EMIS7332/R/copytable.R")
and run the example
copytable(summary(iris))
now copy&paste and you are done!
Just for reference, here is also the source code for the copytable
function:
library(xtable)
copytable <- function(x, ...) {
f <- tempfile(fileext=".html")
print(xtable(x, ...), "html", file = f)
browseURL(f)
}