Question

I have got a simple table in R, a piece of which is included here for reproduction. I'm trying to make a table in HTML out of it via Rmarkdown, using the pander package's pandoc.table function. However, any long enough string gives me an Error in table.expand(x, t.width, justify, sep.col) : Pandoc does not support newlines in simple or Rmarkdown table format!. Any thoughts of how to proceed?

require(pander);
x <- structure(list(Foto1 = c("1370500885054.jpg", "1370501775020.jpg", 
"1370506026170.jpg", "1370504448130.jpg", "1370505124464.jpg"
), Foto2 = c("1370501104750.jpg", "1370501881867.jpg", "1370506100309.jpg", 
"1370504502390.jpg", "1370505159445.jpg"), Foto3 = c("1370501307132.jpg", 
"1370501906419.jpg", "1370506121008.jpg", "1370504662443.jpg", 
"1370505173313.jpg"), Bereich = c("Fussverkehr", "Fussverkehr", 
"Fussverkehr", "Fussverkehr", "Fussverkehr Veloverkehr Behindertengerechtigkeit"
), Beschreibung = c(NA, "Wenn es dunkelnist, ist es gefehrlich", 
"Trottoir endet", "Die parkenden Autos sind im Weg", NA), Loesung = c("Bei beiden Fussgängerstreifen je eine Insel bauen", "Dem baum die Äste abschneiden", "Trottoir weiterführen", "Parkverbot für die Autos", 
"Neuer belag")), .Names = c("Foto1", "Foto2", "Foto3", "Bereich", "Beschreibung", "Loesung"), row.names = 22:26, class = "data.frame")


pandoc.table(x, style='rmarkdown')

throws the error mentioned before. If I avoid the bits with the long strings, it is fine:

pandoc.table(x[3,], style='rmarkdown')

OUTPUT is fine, not included because it doesn't display properly.

Was it helpful?

Solution

This bug has been resolved recently, please check the most recent version of the package:

> library(devtools)
> install_github('pander', 'Rapporter')

Until then, you might just simply disable the automatic line-break for "wide" cells in all tables:

> panderOptions('table.split.cells', Inf)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top