0

I am trying to create a table like the following image: enter image description here

I want this table to be created from rmarkdown to a word file. I have tried to create it using knitr. But it is not being created.

 value_1 <- 0.178
 value_1 <- 0.235

 table <-
    matrix(c(value_1, value_2), ncol = 1, byrow = TRUE)
 rownames(table) <- c("Variable_1", "Variable_2")
 colnames(table) <- c("Value")
 table_final <- as.table(table)

Now, when I use knitr::kable(table_final), in word file I do not see the table, but when I knit in HTML the table comes but there are no column separators.

Is there any way I can create the table as shown in the image using a word document as output in rmarkdown?

Also can we use ggplot()?

jay.sf
  • 60,139
  • 8
  • 53
  • 110
Sagar Jani
  • 161
  • 2
  • 3
  • 21
  • Does following an e.g. like this one help? https://rmarkdown.rstudio.com/articles_docx.html e.g. the `Tables using kable()` section – Jonny Phelps Jun 18 '19 at 11:09
  • Yes I have already tried that. But I am not getting table borders with that. I have a large table and this is just a glimpse of how I want the table. – Sagar Jani Jun 18 '19 at 11:41
  • In order to customize word document output, you'll need to use `reference_docx:`. This post has a summary https://stackoverflow.com/questions/37671868/knitr-rmarkdown-docx-tables/37890832#37890832 – M.Viking Jun 18 '19 at 12:24

0 Answers0