简体   繁体   中英

R Markdown: xtable is knitted partially with code to PDF

I have problem with my tables when knitting them to PDF - the first table isn't printed properly although I used the same pattern for all 3 tables - the first table is printed partially with code: 打印输出

I used this code until the first table:

```{r echo=FALSE, warning=FALSE}
library("markdown")
library(xtable)
options(xtable.comment = FALSE)
```

## Aufgabe:

Die durchschnittliche Anzahl an Brüchen für jeden Wolltyp und Druckvariante ist:

```{r echo=FALSE}
round(with(warpbreaks, tapply(breaks, list(wool, tension), mean)),2)
``` 

## Aufgabe:

```{r echo=FALSE}
a <- as.vector(prop.table(margin.table(UCBAdmissions,c(2,3,1)),c(1,2)))[1:12]
a <- matrix(a,nrow=2)
rownames(a) <- c("Male","Female")
colnames(a) <- c("A","B","C","D","E","F")
```

```{r echo=FALSE}
a <- xtable(a,align=xalign(a),digits=xdigits(a),display=xdisplay(a))
```

```{r results='asis', echo=FALSE}
xtable(a, digits = 1, caption = "Relative Zulassungshäufigkeit (in %) je nach 
Department und Geschlecht")
```

How is it possible to print the first table correctly?

Wrap the output in a raw tex block so Pandoc won't touch it:

````{=tex}
```{r results='asis', echo=FALSE}
xtable(a, digits = 1, caption = "Relative Zulassungshäufigkeit (in %) je nach 
Department und Geschlecht")
```
````

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM