Reputation: 11
Thanks in advance. Basically, I've produced a table and now I just want to print that onto a word document. For some reason however, when I do so it removes all the variables from the table. Could someone pls help me out?
the first line of code is what produced the Rmarkdown table, the second is the one that printed it onto a word document.
Table_1c <- knitr::kable(Table_1b, digits = 3, caption = "Table 1. Descriptive Statistics")
tab_df(Table_1b, title = "Table 1. Descriptive Statistics", file = "Table_1c.doc")
Upvotes: 0
Views: 268
Reputation: 41469
The file
option in the tab_df
function allows to save the table as image in a HTML file. I will show you an example.
First the data sample as example:
# DATA
Table_1b <- iris[1:5,]
Table_1b
Output:
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
Next load package and set working directory to store the table as html file:
library(sjPlot)
# Set working directory
setwd("~/Downloads")
tab_df(Table_1b, title = "Table 1. Descriptive Statistics", file = "Table_1c.html")
Upvotes: 1