r-markdown

pandoc document conversion failed with error 127

99封情书 提交于 2020-01-11 08:27:28
问题 I'm not sure how to make a reproducible example of this, but I'm curious to hear if anyone else has encountered this problem. I have an R Markdown file hosted via shiny server on an EC2 instance running Ubuntu. Everything was working fine for days and now suddenly I get the following error when I try to view the document in the browser: pandoc document conversion failed with error 127 I'm not converting to pdf, haven't pushed any changes, and it was working a few hours ago. I'm not finding

Rmarkdown: Multiple plots on same page with separate captions

≯℡__Kan透↙ 提交于 2020-01-11 06:43:09
问题 I am writing a report in R markdown with a pdf output. I have several plots and I would like to display four plots per page laid out in a 2x2 matrix. Is there a way to get them to display like that with separate captions? Here is what I have tried so far: Package gridExtra - I can easily setup the layout I want but I wasn't able to add captions to the plots.Is there an option to add captions to the plot in grid.arrange ? Placing each plot in a different chunk and playing with R chunk options.

How to cite within a figure caption w/ rmarkdown native citation?

随声附和 提交于 2020-01-11 04:08:31
问题 In R Markdown, I want a figure caption with a linked citation in R Markdown native citation style [@ref] . However, when I insert the [@hawking_thermodynamics_1983] snippet at the end into the caption, it's throwing just an error: ! Missing $ inserted. <inserted text> $ l.94 ...iontextfoo [@hawking_thermodynamics_1983]} pandoc.exe: Error producing PDF Error: pandoc document conversion failed with error 43 Example : This is my code: --- title: "Untitled" author: "Author" output: pdf_document #

Embedding plotly output in R markdown

被刻印的时光 ゝ 提交于 2020-01-10 20:04:46
问题 There is a blog entry which describes embedding from the plotly API for R into R markdown. I just used the code to create the iframe for an html document When I have the prieview in R studio there is no error message and the iframe is created in the html document. However, it is just empty. Apparently it does not load the content somehow. I did not create the plot in the R API beforehand (but that should not matter as this is just embedding a picture into html) isn't it? My code in r markdown

Embedding plotly output in R markdown

£可爱£侵袭症+ 提交于 2020-01-10 20:03:52
问题 There is a blog entry which describes embedding from the plotly API for R into R markdown. I just used the code to create the iframe for an html document When I have the prieview in R studio there is no error message and the iframe is created in the html document. However, it is just empty. Apparently it does not load the content somehow. I did not create the plot in the R API beforehand (but that should not matter as this is just embedding a picture into html) isn't it? My code in r markdown

Inserting title page with image in Rmarkdown to render a pdf document

試著忘記壹切 提交于 2020-01-10 18:56:29
问题 In Rmarkdown, the following sets the context to generate the pdf document: --- title: "My Report" author: NDE output: pdf_document: fig_caption: true toc: true highlight: kate --- I want to insert a title page with an image, title before table of contents gets printed. Is there a way I can achieve it? 回答1: For me it worked using LaTeX commands \clearpage and \tableofcontents : --- title: "image before toc" output: pdf_document --- \centering ![Caption](folder/image.png) \raggedright

Centering image and text in R Markdown for a PDF report

拜拜、爱过 提交于 2020-01-10 09:14:15
问题 I want to center an image and/or text using R Markdown and knit a PDF report out of it. I have tried using: ->Text<- ->![](image1.jpg)<- That does not do the trick! Any other way of getting this done? 回答1: If you are centering the output of an R code chunk, e.g., a plot, then you can use the fig.align option in knitr. ```{r fig.align="center"} plot(mtcars) ``` 回答2: I had the same question. I have tried all solutions provided above and none of them worked... But I have found a solution that

R: how do you embed plots into a tab in RMarkdown in a procedural fashion?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-10 05:20:06
问题 I can embed plots using just RMarkdown's {.tabset} #### Heading {.tabset} ##### Subheading 1 ```{r, echo=F} df[[1]] ``` This produces individual tabs with the specified graphs ( df is a list of graphs, calling df[[i]] produces a graph) in the preview pane (renders all the graphs inline in RStudio). And I can generate just the tabs using a for loop. ```{r, results='asis', echo = FALSE} for (i in 1:length(gg0)) { cat("##### ",q$Subheading[i],"\n") } ``` And this produces the desired output -

R Markdown similar feature to “newcommand” in LaTex?

我们两清 提交于 2020-01-10 02:35:28
问题 Does R Markdown have a similar construct to LaTex's "newcommand"? I would like to be able to define things like \var to be \mathrm{Var} to avoid the extra typing in math mode. If not, what do people do to reduce repetition in typesetting equations in markdown? 回答1: Use \newcommand{\var}{\mathrm{Var}} exactly like you would in LaTeX: --- title: "Untitled" author: "An Author" date: "January 15, 2017" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ```

Why does rendering a pdf from rmarkdown require closing rstudio between renders?

[亡魂溺海] 提交于 2020-01-09 13:09:50
问题 Background I am trying to make a rmarkdown document that is rendered using render() . The render call has two elements that are parameterized: I would like the user to be able to specify pdf or html. Straightforward using output_format() . I also would like to pass a parameter to the document to specify if the tables (using the kableExtra package) are latex or html. This is the rmarkdown file called test.Rmd --- title: "Title" author: "Zzz Zzzzzz" params: table_format: value --- ```{r setup}