Flextable in .pdf markdown files

288 views
Skip to first unread message

Conal Monaghan

unread,
May 22, 2017, 7:44:22 PM5/22/17
to knitr

Hi everyone, 

           I am trying to knit to .pdf using rMarkdown. When knitting flextables (FlexTable {ReporteRs} object), which is the output style from apaStyle package's apatable() function, the .pdf writes each number from the table on seperate pages without the table. Rendering the table in rStudio or using .html works perfectly, it just seems to be an issue using Word and .pdf rendering. For example, when running the code below rendering in .pdf. 

Thanks for all of your help in advance, 

             Conal

 ---
 title: "Test"
 author: "Test"
output:
  pdf_document: default
  latex_engine: xelatex
---
```{r, echo=FALSE, message = FALSE, warning=FALSE
# Specify statistics
example <- data.frame(
c("Column 1", "Column 2", "Column 3"),
c(3.45, 5.21, 2.64),
c(1.23, 1.06, 1.12),
c(8.22, 25.12, 30.27),
c("+", "**", "***")
)

# Run method and preview table
apa.table(
data = example,
level1.header = c("", "Descriptives", "Inferential"),
level1.colspan = c(1, 2, 2),
level2.header = c("Variable", "M", "SD", "t-value", "*")
)$table
```

How to Tag

A tag is a keyword or label that categorizes your question with other, similar questions.

 favor existing popular tags; avoid creating new tags

 use common abbreviations

 don't include synonyms

 combine multiple words into single-words with dashes

 maximum of 5 tags, 25 chars per tag

 tag characters: [a-z 0-9 + # - .]

 delimit tags by space, semicolon, or comma

popular tags »


Jeff Newmiller

unread,
May 22, 2017, 8:29:10 PM5/22/17
to Conal Monaghan, knitr
As far as I know, this is not possible, because ReporteRs does not support LaTeX.

Fortunately, there are some very powerful packages for supporting tables in LaTeX such as the tables package, but you will probably need to learn some LaTeX to do all the other stuff you might want to do. 


--
You received this message because you are subscribed to the Google Groups "knitr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knitr+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages