r-markdown

R Markdown: xtable is knitted partially with code to PDF

旧街凉风 提交于 2021-02-10 18:19:41
问题 I have problem with my tables when knitting them to PDF - the first table isn't printed properly although I used the same pattern for all 3 tables - the first table is printed partially with code: I used this code until the first table: ```{r echo=FALSE, warning=FALSE} library("markdown") library(xtable) options(xtable.comment = FALSE) ``` ## Aufgabe: Die durchschnittliche Anzahl an Brüchen für jeden Wolltyp und Druckvariante ist: ```{r echo=FALSE} round(with(warpbreaks, tapply(breaks, list

How do I convert RMarkdown ioslides presentations to 2-up PDFs programmatically?

大兔子大兔子 提交于 2021-02-10 12:29:27
问题 I use rmarkdown to generate ioslides HTML presentations, using custom css. This bit is great and I love it. My question is about generating 'notes' versions of presentations. The only way I've seen to get 2up PDF A4 notes from these slides is to print out of Safari, by clicking Print..., then landscape, then layout 2pages, then border = hairline, then save as. then find the right folder etc. However, it gets the formatting and fonts right, and Webkit renders things that Chrome or other

How to make multi-column Layout in R Markdown when rendering PDF?

こ雲淡風輕ζ 提交于 2021-02-10 06:36:20
问题 This is a great answer on how to do a 2-column layout in R-Markdown when rendering PDF. Basically the answer is 'add the following to the header': --- output: pdf_document: classoption: twocolumn --- But how do I make it three columns or more ? 回答1: To generate a html file with multiple columns, you could use the CSS grid layout: --- output: html_document --- :::: {style="display: grid; grid-template-columns: 20% 50% 20%; grid-column-gap: 5%; "} ::: {} contents... ::: ::: {} contents... ::: :

R read_yaml() reads a vector as parameter

那年仲夏 提交于 2021-02-10 06:29:08
问题 I would like to read a .yaml file to get yaml parameters for a Rmarkdown report. Original I have a yaml header to define a vector. --- params: ids: !r c(2455, 2490) --- and it works, where params$ids is a vector. However, if I put ids: !r c(2455, 2490) into a report_params.yaml file, and read that yaml file by report_params <- yaml::read_yaml("report_params.yaml") now report_params$ids is a string 'c(2455, 2490)' . so what did I miss, and how should I fix this? 回答1: The YAML default handler

Rmarkdown - Duplicated TOC (Table of content)

不问归期 提交于 2021-02-09 10:57:33
问题 Hello StackOverflow community, When creating an Rmarkdown document all goes fine and table of content appears as intended. TOC Correct When I open the HTML in my browser from Rstudio to my browser it does as well appear correctly. The issue happens when I save that HTML and open it later on or send it to somebody, the TOC would then appear duplicated. TOC with duplicated items Below is the code used regarding the toc in my .rmd file. output: html_document: toc: true toc_float : true Would you

Add two commands to the add.to.row arguments in xtable

别等时光非礼了梦想. 提交于 2021-02-08 16:56:56
问题 I have used the two answers below to add colors to alternating rows in xtable or to add a footer to a long table, but I need to figure out how to do both. (1) How to only show table caption once in "list of table" for a table split onto multiple pages and (2) R, knitr, xtable, alternating row colors Is there a way to use both at the same time? 回答1: From the answers you listed it seems you used LaTeX as output. You can combine two or more add.to.row command by assigning a position to each

Add two commands to the add.to.row arguments in xtable

╄→尐↘猪︶ㄣ 提交于 2021-02-08 16:56:10
问题 I have used the two answers below to add colors to alternating rows in xtable or to add a footer to a long table, but I need to figure out how to do both. (1) How to only show table caption once in "list of table" for a table split onto multiple pages and (2) R, knitr, xtable, alternating row colors Is there a way to use both at the same time? 回答1: From the answers you listed it seems you used LaTeX as output. You can combine two or more add.to.row command by assigning a position to each

How do I provide only the year in a citation in R markdown?

社会主义新天地 提交于 2021-02-08 12:57:11
问题 My rmarkdown script looks as follows: --- title: "Untitled" author: "me" date: '`r format(Sys.time(), "%d %B, %Y")`' output: pdf_document: default bibliography: bibliography.bib --- In his book Helsel explains how to approach censored environmental data [@helsel_statistics_2012]. MY .bib file as such: @book{helsel_statistics_2012, address = {Hoboken, N.J}, edition = {2nd ed}, series = {Wiley series in statistics in practice}, title = {Statistics for censored environmental data using {Minitab}

Alignment of images in tables with markdown, rstudio and knitr

China☆狼群 提交于 2021-02-08 10:17:22
问题 I'm trying to create a standard monthly report for work in PDF format using Rstudio and I want to incorporate ggplot output with a table of figures - a new chart, one per cell on each row. I'm new to markdown, latex, pandoc and knitr so this is a bit of minefield for me. I have found out how to insert the charts using kable but the images are not aligned with the text on the same row. I've put some (rstudio markdown) code using dummy data at the bottom of my question, and here are some images

How to generate LaTeX file without preamble in R markdown?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-08 09:01:39
问题 I have a LaTeX document that is split to multiple .tex files. I'm using R markdown to generate figures and tables. Is it possible to generate .tex file from .Rmd without preamble, so that I will be able to just use output in my document? Currently, I need to manually copy part of the output to my .tex file 回答1: Let's suppose your child document is named child.Rmd and has the following contents. ```{r pressure, echo=FALSE, dev='pdf'} plot(pressure) ``` Run knitr::knit("child.Rmd") and you get