pander

Inserting blank spaces at the end of a column name in a table using pander

試著忘記壹切 提交于 2019-12-24 16:35:44
问题 I am trying to find a way of centering a column heading in a pander table using knitr to pdf in rmarkdwon, but keeping the column entries right justified. --- title: "Table Doc" output: pdf_document --- ```{r table, echo = FALSE} table1 <- anova(lm(Petal.Length ~ Species*Petal.Width, iris)) names(table1) <- c("DF", "Sum Sq", "Mean Sq", "*F*", "*p*") library(pander) pander(table1, justify = c("left", rep("right", 5))) ``` There is no way to align individual cells inside a table in pandoc

Issue with creating PDf file with Pander+Knitr: Error when putting table with caption and plot directly next to each other

我怕爱的太早我们不能终老 提交于 2019-12-24 05:13:24
问题 I have a reproducible error with pander (+ knitr): When a table with caption and a plot is put directly to each other, I cannot create a PDF File. I use pander 0.5.1, knitr 1.7, R version 3.1.1, Miktex + RStudio on Windows. So the following will produce the error (see also my List of errors and non-errors below): ```{r, echo=FALSE, eval=TRUE} pander(cor(cars), caption="Whatever" ) # or some other captioned table hist(cars$speed) #or some other plot ``` pandoc.exe: Error producing PDF from TeX

Keep trailing zeros for percents only

旧城冷巷雨未停 提交于 2019-12-23 16:03:27
问题 Given the following example: library(pander) tableAbs <- Titanic[1, 1, , ] tablePct <- round(prop.table(tableAbs) * 100, 2) table <- cbind(tableAbs, tablePct) pander(table) ----------------------------------   No Yes No Yes ----------- ---- ----- ----- ----- **Child** 0 5 0 2.78 **Adult** 118 57 65.56 31.67 ---------------------------------- I would like to keep all trailing zeros on that 0 percentage over there, so this is what I do: panderOptions("keep.trailing.zeros", TRUE) pander(table) -

In knitr, no output from pander in for loop

ⅰ亾dé卋堺 提交于 2019-12-21 09:38:32
问题 Using knitr in RStudio, pander does not produce any (or correct) html output when in a for loop. Here is a minimal case, as an Rmd input file. --- title: "Untitled" output: html_document --- Testing why pander doesn't work in for loop ```{r global_options, include=FALSE} knitr::opts_chunk$set(fig.width=7, fig.height=5, echo=FALSE, warning=FALSE, message=FALSE) ``` ```{r} library(pander) r <- 1:10 print("pander at top level") pander(summary(r)) # works print("pander in for loop") for (i in 1:2

Issue with Pander+Knitr: Error when using pander.list

不羁的心 提交于 2019-12-19 07:48:52
问题 Another reproducible error with pander (+ knitr): When I try to pander a list, I cannot create a PDF File - it seems to occur when a table or data.frame is put inside the list. If only vectors are in the list, the PDF compiles but looks ugly. I use pander 0.5.1, knitr 1.7, R version 3.1.1, Miktex + RStudio on Windows. Doesn't work: ```{r, eval=FALSE} pander(list(cor=cor(cars) ) ) ``` Error: output file: Preview-e905ccd5f1a.knit.md ! Undefined control sequence. l.246 \textbf{cars}: {[}1{]} ``

How to set the number of decimals in report produced with knitr/pander?

情到浓时终转凉″ 提交于 2019-12-18 15:47:15
问题 I know it's a fairly old problem, and it has been discussed before, but I can't get it work as expected. I have a markdown document, and I would like to use knitr and pander to produce a .docx report with a consistent numeric format with two decimals, such as 0.12, 3.60, 14.00, or 163.21 for both inline and chunk outputs. I have read this thread How to avoid using round() in every \Sexpr{}? where it was suggested that pander can do that automatically. However, it does not seem to work for me.

Pander formats tables weirdly when using significance stars and pandoc

断了今生、忘了曾经 提交于 2019-12-12 16:47:06
问题 If I run a linear regression with significance stars, render it through pander, and "Knit PDF" such as this: pander(lm(crimerate ~ conscripted + birthyr + indigenous + naturalized, data = data), add.significance.stars = T) I occasionally get output where there is weird spacing issues between rows in the output table. I've tried setting pander options to report fewer digits panderOptions('digits', 2) , but the problem persists. Does anybody have any ideas? 回答1: I had the same problem.

R Markdown, output test results (htest) when chunk option results=“asis”

烈酒焚心 提交于 2019-12-11 07:25:49
问题 I need to use results = "asis" for reasons stated here: https://stackoverflow.com/a/36381976/ However, using that chunk option means other outputs render non-ideally. Specifically I'm having issues outputting prop.test results, but I'm sure this would happen for other data types. I've provided 4 options in the example below, all of which fall short in some way: --- title: "R Notebook" output: html_document: df_print: paged --- ```{r, echo=F, message=F, warning=F, results="asis"} library(knitr

In R, how can we add significance stars to a kable() table?

假如想象 提交于 2019-12-11 07:18:36
问题 Using knitr::kable() function to create a .doc table through rmarkdown, how could we add "significance stars symbols" from a given data frame (df.b) (i.e. cutpoints = c(0, .001,.01,.05, .1, 1), symbols = c("^{***}","^{**}","^{*}","^{.}"," ")) near the values stored in another data frame (df.a)? knitr::kable(df.a) Would pander::add.significance.stars() work on this purpose, in a similar way as used here? Data df.a <- structure(list(X1 = structure(c(3L, 2L, 4L, 1L), .Label = c("-0.29 (-0.54 - 0

How to position and format length of a table's title [R Markdown, pander package]

我的未来我决定 提交于 2019-12-10 19:15:38
问题 I am preparing R Markdown document in the pdf format. In the document I have a couple of tables. I used pander package to format tables. Suppose that I have data frame, DF, that I want to transform into table in the pdf output. To achieve that in a r code chunk I changed panderOptions for table caption prefix in order to print it in NON-English language and in the next line I call pander function with specified caption argument. Here is relevant part of R Markdown code: --- title: "Let's try!