Ich muss einige Werte in Daten vergleichen und wöchentliche Trends anzeigen. Ich möchte zeigen, ob ein Wert von letzter Woche gestiegen ist. Ich habe einen Rmarkdown-Bericht erstellt, um es zu tun. Ein Beispiel-Code ist unten dargestellt, die perfekt funktioniert, wenn output: html_document
aber Ausgang Schritte völlig daneben ist bei der Verwendung von output: word_document
HTML formatierte Tabellen in rmarkdown Word Dokument
---
title: "trials"
author: "Foo Bar"
date: "15 December 2016"
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r cars, echo=FALSE, cache=FALSE, message=FALSE}
library(dplyr, quietly = TRUE)
library(abind, quietly = TRUE)
virginica <- iris %>% filter(Species == "virginica") %>% head() %>% select(-Species)
setosa <- iris %>% filter(Species == "setosa") %>% head() %>% select(-Species)
diff_mat <- virginica - setosa
diff_mat[diff_mat<0] <- '<font color="green">⇓ </font>'
diff_mat[diff_mat>0] <- '<font color="red">⇑ </font>'
diff_mat[diff_mat == 0] <- '<font color="blue">⇔ </font>'
datArray <- abind::abind(virginica, diff_mat, along=3)
fin_dat <- apply(datArray,1:2, function(x)paste(x[1],x[2], sep = " "))
knitr::kable(fin_dat, format = "html",
escape = FALSE, table.attr = "border=1",
caption = "Changes across species")
```
Wie kann ich das Wort Version des Dokuments ähnlich die HTML-Version formatiert werden?
Vielleicht versuchen Sie 'Bookdown :: Word_Document2' – Ben