简体   繁体   中英

R pander package: Unable to run CrossTable example in Rmd document

I am unable to compile a Rmd as pdf with the CrossTable example from the "Using pander with knitr" vignette.

Here is my code

---
title: "Pander CrossTable test"
author: "Christiaan Pauw"
date: "08 March 2016"
output: pdf_document
---

```{r }
library(pander)
library(descr, quietly = TRUE)
pander(CrossTable(mtcars$gear, mtcars$cyl))
```

The error message reads: output file: Untitled.knit.md

! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.159 ~\\15\\\\

pandoc: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
Execution halted

Here is my session info

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] descr_1.1.2    pander_0.6.0   ggplot2_2.0.0  reshape2_1.4.1 stargazer_5.2  raster_2.5-2  
[7] Matrix_1.2-3   sp_1.2-1      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.3       knitr_1.12.3      magrittr_1.5      munsell_0.4.2     colorspace_1.2-6 
 [6] xtable_1.8-0      lattice_0.20-33   stringr_1.0.0     plyr_1.8.3        tools_3.2.3      
[11] grid_3.2.3        gtable_0.1.2      htmltools_0.3     yaml_2.1.13       digest_0.6.9     
[16] rmarkdown_0.9.5.1 stringi_1.0-1     scales_0.3.0  

For the record: The problem seemed to solve itself. When I returned to this problem after a few updates everything worked

It works for R version 3.3.0 with Rstudio Version 0.99.902. The pandoc version is 1.15.2

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