So che questa domanda è simile a this uno. Ma non sono riuscito a trovare una soluzione così da postarla di nuovo qui.Come replicare Knit HTML in una riga di comando?
Voglio ottenere esattamente lo stesso risultato ottenuto facendo clic su "Knit HTML" ma tramite un comando. I tryied usando knit2html ma pasticci con la formattazione e non include il titolo, kable non funziona ecc
Esempio:
Questo è il mio file test.Rmd,
---
title: "test"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
library(knitr,quietly=T)
kable(summary(cars))
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
uscita:
Knit HTML
knit2html
FWIW preferisco l'uscita di linea di comando. –
@KonradRudolph: Non funzionerà per me. Questo è solo un codice di esempio che ho inventato. Il mio caso d'uso reale ha una grande tabella con 8 colonne e 10 righe. L'output della riga di comando apparirà brutto. – Avinash
Questo è principalmente dovuto al fatto che entrambe le opzioni (!) Formattano male le tabelle per impostazione predefinita. Vedi la mia risposta per un'opzione migliorata. –