r-markdown

Split r chunk header across lines in knitr

岁酱吖の 提交于 2020-01-05 03:39:50
问题 When I'm inserting long captions and the like in my R chunk header, it'd be nice to be able to split the header across multiple lines. Is there any easy way to do this? E.g.: ```{r, echo=FALSE, warning=FALSE, fig.cap="Here is my really long caption. It'd be nice to split this and other portions across lines"} print(plot(x=runif(100),y=runif(100))) ``` 回答1: No, you cannot insert line breaks in chunk options. From the manual: Chunk options must be written in one line; no line breaks are allowed

How to interrupt an incremental list of items in Rmarkdown, then retake it after a plot or figure?

本秂侑毒 提交于 2020-01-05 03:36:35
问题 I'm really interested in interrupting incremental lists of items created in Rmarkdown with RStudio, to show plots and figures, then retake the list highlighting. This is quite straightforward in Latex, but I couldn't figure out how to achieve the same result using Rmarkdown. Below is some beamer example. --- title: "Sample Document" author: "Author" output: beamer_presentation: fonttheme: structurebold highlight: pygments incremental: yes keep_tex: yes theme: AnnArbor toc: true slide_level: 3

Shiny renderPlot within Interactive Document opens a new Browser Window with dygraph

巧了我就是萌 提交于 2020-01-04 09:29:10
问题 I have the following RMarkdown .Rmd document. When you run the following, the sliderInput is "reactive" and adjust the smoothing appropriately; however, the plot keeps generating in a new separate browser window rather than within the document itself. Any ideas why this is happening or how to fix this behavior? --- title: "Untitled" output: html_document runtime: shiny --- ```{r echo=FALSE} library(dygraphs) sliderInput("span", label = "Select Span", min=0.05, max=1, value=0.5, step=0.05)

Inline code chunk for non-numeric variables in knitr

核能气质少年 提交于 2020-01-04 06:23:12
问题 I'm trying to use inline R Markdown code to access the first level of a factor. I can get it to work if I use a chunk but not if I do it inline. So while this works: ```{r} as.character(iris$Species[1]) ``` This does not: `r as.character(iris$Species[1])` I could get the inline version to run if I saved the cache and knitted the document twice. I just found this a bit odd because numeric variables behave differently. So, for instance, this works without having to knit it twice `r mean(iris

LaTeX Error: Environment ThreePartTable undefined

我只是一个虾纸丫 提交于 2020-01-04 06:01:46
问题 I am trying to create a table using apa_table() , Papaja, and RMarkdown in RStudio. Whenever I include longtable in the apa_table function, I get the error: ! LaTeX Error: Environment ThreePartTable undefined. Strangely, the error log that's produced includes: (/home/tim/.TinyTeX/texmf-dist/tex/latex/threeparttable/threeparttable.sty Package: threeparttable 2003/06/13 v 3.0 and Package caption Info: threeparttable package is loaded. Note the different capitalization between the error and the

Efficient way to wrap column names of proportion tables in rmarkdown pdf output

白昼怎懂夜的黑 提交于 2020-01-03 19:33:07
问题 I'm making weighted tables of row proportions using the questionr package. I want to wrap the column names when they are too long. Because I'm making hundreds of tables, the solution needs to work on tables with varying numbers of columns. I also want to avoid setting all columns to a specific width. Ideally, short column names would remain at their normal width while names exceeding the specified maximum length would be wrapped. Here are a bunch of solutions I've tried so far, written as

Unable to produce landscape orientation microsoft word document from R markdown when using classoption: landscape

谁说胖子不能爱 提交于 2020-01-03 18:06:05
问题 I am unable to produce a landscape orientation document when using RStudio and Rmarkdown. R is version 3.4.2 RStudio is version 0.98.1103 I cannot change these as they are the latest versions on the cluster which I run my programs on. After knitting the document, I do get a document out (in portrait form), however get the following error message: Output created: test_landscape.docx Warning message: In (function (toc = FALSE, toc_depth = 3, fig_width = 5, fig_height = 4, : table of contents

Unable to produce landscape orientation microsoft word document from R markdown when using classoption: landscape

本秂侑毒 提交于 2020-01-03 18:04:29
问题 I am unable to produce a landscape orientation document when using RStudio and Rmarkdown. R is version 3.4.2 RStudio is version 0.98.1103 I cannot change these as they are the latest versions on the cluster which I run my programs on. After knitting the document, I do get a document out (in portrait form), however get the following error message: Output created: test_landscape.docx Warning message: In (function (toc = FALSE, toc_depth = 3, fig_width = 5, fig_height = 4, : table of contents

Unable to produce landscape orientation microsoft word document from R markdown when using classoption: landscape

折月煮酒 提交于 2020-01-03 18:04:26
问题 I am unable to produce a landscape orientation document when using RStudio and Rmarkdown. R is version 3.4.2 RStudio is version 0.98.1103 I cannot change these as they are the latest versions on the cluster which I run my programs on. After knitting the document, I do get a document out (in portrait form), however get the following error message: Output created: test_landscape.docx Warning message: In (function (toc = FALSE, toc_depth = 3, fig_width = 5, fig_height = 4, : table of contents

Split title in two lines in Rmarkdown for word output

百般思念 提交于 2020-01-03 17:47:29
问题 I have seen various solutions around which work for pdf and HTML document output. However, none worked for me for word output. When used | as suggested here: Split the title onto multiple lines? simply made the whole title disappear. Here is the code: --- title: | | Supporting Information | Development and mechanistic bla bla. author: Some people output: word_document: reference_docx: ACS SI style for RMD.docx mainfont: Arial --- <style> body { text-align: justify} p {line-height: 1.5em;} <