r-markdown

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

Producing pdf with knitr and Rmarkdown: accents in text show up but not in figures.

做~自己de王妃 提交于 2019-12-11 07:17:06
问题 Accents in paragraphs work perfectly. Text in figures is correct in the plot viewer, but once I compile the pdf the accents disappear from the figures. Here's an example that reproduces the issue. --- title: 'Some title' author: 'This be me' date: '`r format(Sys.Date(), "%B %Y")`' lang: es header-includes: - \usepackage{tikz} output: pdf_document: fig_caption: yes --- ```{r global options, echo = F, message=F} library(knitr) opts_chunk$set(fig.width=6, fig.height=3.5, dev = 'tikz') ``` I have

R Markdown Footnote in xtable

倖福魔咒の 提交于 2019-12-11 06:43:46
问题 I'm having issues with a footnote not appearing under a table in my R Markdown report. Below is the code I'm using to process which does successfully but with no footnote appearing under the table. ```{r ccxtable7, results="asis", echo=FALSE} comment <- list(pos = list(0), command = NULL) comment$pos[[1]] <- c(nrow(indPctChgCC)) comment$command <- c(paste("\\hline\n", "{\\footnotesize Note: * signifies number of properties used was 35 or less.}\n", sep = "")) print(xtable(valPctCon

R Markdown knit fails when path includes “~” for html/pdf document but works for ioslides

China☆狼群 提交于 2019-12-11 06:21:11
问题 As of knitr 1.12, there is the function include_graphics. From ?include_graphics: The major advantage of using this function is that it is portable in the sense that it works for all document formats that knitr supports, so you do not need to think if you have to use, for example, LaTeX or Markdown syntax, to embed an external image. It seems that include_graphics() handles paths with "~" in them (shortcut to user directory) when knitting an ioslides Rmarkdown presentation, but fails when

Consistent math equation numbering in bookdown across pdf, docx, html output

不羁的心 提交于 2019-12-11 05:39:30
问题 In bookdown, is there a LaTeX math environment which numbers each equation, regardless of whether the ouptut is .pdf, .docx, .html? Adding this LaTeX: \begin{align} X &= Y \\ Z &= W \end{align} Into the bookdown-demo outputs the following: PDF: works as expected. DOCX: missing equation numbers. HTML: missing equation numbers. Notes: The output was generated using pdf_book , word_document2 , gitbook . This is related to an unanswered question of mine: Align environment in R Markdown which

MathJax script issue after customizing rstudio.markdownToHTML()

江枫思渺然 提交于 2019-12-11 05:33:30
问题 With knit2html() from the knitr package, I can generate html pages that contain latex equations and R code. But on my system equations are not rendered when using RStudio's "knit html" button. It is because I have modified the way the "knit html" button works. To include a table of content on my html pages, I followed the Rstudio advice on Customize Markdown Rendering. And created an .Rprofile file at the root of the project directory that overrides default markdown rendering options. My

Create hyperlink in table and adjust column to wrap text Rmarkdown

删除回忆录丶 提交于 2019-12-11 05:18:44
问题 I am trying to create hyperlinks inside a table and also adjust columns to wrap text and generate pdf. Ex table: variable<-"testing a long column to wrap testing a long column to wrap " col1<-"\href{https://www.google.co.uk/}{click here}" col2<-"[click here](https://www.google.co.uk/)" col3<-"[click here](https://www.google.co.uk/)" col4<-"[click here](https://www.google.co.uk/)" col5<-"[click here](https://www.google.co.uk/)" test<-data.frame(variable,col1,col2,col3,col4,col5) When I tried

Adjust spacing between text and chunk output in a R Markdown PDF document

梦想与她 提交于 2019-12-11 05:15:40
问题 I'm having trouble understanding how to control spacing between the text and chunk output in a R Markdown PDF document. Below is an example of a document: --- output: pdf_document --- \setlength\lineskip{0pt} \begin{center} Random Text \end{center} ```{r echo = FALSE, message=FALSE} library(tidyverse) p1 <- ggplot(mtcars, aes(x = row.names(mtcars), mpg)) + geom_bar(stat = "identity") + theme(panel.border = element_rect(colour = "black", fill=NA, size=1), plot.margin=grid::unit(c(0,0,0,0), "mm

Conditional slides in R markdown (beamer presentation)

寵の児 提交于 2019-12-11 05:14:03
问题 Is it possible to have conditional slides in R markdown (beamer presentation)? I tried using R code chunk hacks with results = 'asis' and further tried using custom LaTeX commands but to no avail. One problem seems to be that each markdown slide delimiter actually results in the combination of both \end{frame} \begin{frame} so it is hard to conditionally exclude a slide. 来源: https://stackoverflow.com/questions/43396667/conditional-slides-in-r-markdown-beamer-presentation