r-markdown

get rid of captions when using texreg in Rmarkdown

大城市里の小女人 提交于 2019-12-22 18:11:11
问题 How do you suppress captions for a texreg table? I'm using Rmarkdown to generate a LaTeX file. Here's a simple example: ```{r, echo=FALSE, message=FALSE, results="asis"} library(texreg) data <- data.frame(a=c(1,2,3,4), b=c(6,3,4,4)) texreg(lm(a~b, data=data), caption="", custom.note="", float.pos="h!") ``` The table I get has a caption on the bottom that says "Table 1:". How do I get rid of it? Thanks. 回答1: In the YAML section where LaTeX packages can be included, add the caption package:

How to add feature or thumbnail image for post in .Rmd file

五迷三道 提交于 2019-12-22 14:39:15
问题 I'm currently trying to setup a hugo blog with blogdown and can't find a way to add feature or thumbnail images to posts from within .Rmd files, which would like this with the tranquilpeak theme: As far as I understand, it is easy to do in .md files by just adding some syntax like this: +++ featuredImage = "img/foobar.jpg" +++ I found this in the minos theme and in a discourse post. But how can I do this inside a .Rmd file? 回答1: It does not matter whether you use .md or .Rmd: if the theme

Center leaflet in a rmarkdown document

二次信任 提交于 2019-12-22 12:27:11
问题 I want to create an html document with a centered leaflet widget inside it. --- title: "Exemple" author: "Antoine Bichat" date: "31/08/2018" output: html_document --- ```{r leaflet, fig.align="center"} library(leaflet) leaflet() %>% addTiles() %>% addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R") ``` The first idea with fig.align="center" doesn't work. I found this question and I adapted it to my case: <style> /* resize the widget container */ .leaflet { width: 80% !important;

Rmarkdown to Word output - insert image above header

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 11:04:20
问题 I have an Rmarkdown document which I'm outputting to Word and I'm trying to insert a company logo to the top of the page, above the header that includes the title and author. I haven't found a solution to this. I've tried using pandoc_args to --include-in-header , but this wasn't successful. I'm not confident that I was using it correctly though. Is it possible to include an image above the header? --- title: "Untitled" author: "r.bot" date: "Thursday, January 1, 2015" output: word_document:

How to print htmlwidgets to HTML result inside a function?

女生的网名这么多〃 提交于 2019-12-22 10:50:57
问题 --- title: "Untitled" output: html_document --- ```{r setup, include=FALSE} library(DT) xsx = function(){ print(getOption("viewer")) print(datatable(data.frame(d =1))) 1 } xsx() ``` Inside xsx() function, DT widgets will not be rendered in HTML result. How can I get widgets print inside a function? 来源: https://stackoverflow.com/questions/35567124/how-to-print-htmlwidgets-to-html-result-inside-a-function

Can I set the CSS/JS paths parametrically in Xaringan YAML?

淺唱寂寞╮ 提交于 2019-12-22 10:09:17
问题 This is similar to Xaringan issue #29. I'm setting up a Xaringan template to be used at work, and I want to keep all the CSS and Javascript files in the same location. I don't want anyone to have to copy the same files into each presentation directory. However , I also don't want to refer to a common root directory. I could (I think) point to our in-house Bitbucket server, but I would much rather analysts and data scientists be able to get the files from their local repo (for speed, and also

Increment section numbers in PDF output

百般思念 提交于 2019-12-22 09:59:36
问题 I'm trying to increment the section headers in my rMarkdown (PDF output) file by 1. Instead of # First resulting in 1 First , I'd like 2 First. I found a way to define the offset in html_output using the following syntax, but it doesn't work for pdf_output. --- title: "Untitled" author: "author" date: "date" output: html_document: toc: true pandoc_args: [ "--number-sections", "--number-offset=1" ] --- # First Header # First SubHeader This results in 2 First Header 2.1 First Subheader However,

R Notebook - code chunk gets separated in preview

帅比萌擦擦* 提交于 2019-12-22 09:37:27
问题 I am using R notebook to preview the file. Even though all the code is in one chunk, a line gets separated into two. Would you please tell me how I can resolve this? As you can see all the code is in one chunk. However, when I run this chunk, it gets separated into two. I am not sure if it matters but here is the code I am running. library(MASS) par(mfrow=c(3,1)) hist(galaxies, breaks=500) hist(galaxies, breaks=100) hist(galaxies, breaks=50) Also here are the versions of R and RStudio. I an

How to access MathJax extensions (like siunitx) from Rmarkdown via Pandoc & Knitr?

寵の児 提交于 2019-12-22 09:29:00
问题 Working with Rmarkdown in Rstudio , using pandoc and knitr , I am targetting PDF output via LaTeX and HTML output with MathJax . I would like to use some of the MathJax extensions that are available, to allow richer LaTeX for the PDF target. Specifically, I am trying to use the siunitx extension right now, although I am also interested in others (e.g. physics ). Using siunitx works fine with LaTeX for PDF output, but I've had a hard time getting it working with HTML output. Here an example

How to embed and escape R Markdown code in a R Markdown document

时光总嘲笑我的痴心妄想 提交于 2019-12-22 08:44:13
问题 I'm trying to write a memo on R Markdown syntax and as such I'd like to include in the document's output the R Markdown code and the output. To be clear, I'd like the output to look something like: ~~~~~~~~~~~~~~~~~~ Including the following code chunk in the document: ```{r, eval=FALSE} summary(cars) ``` will produce the following output: summary(cars) ~~~~~~~~~~~~~~~~~~ I'm failing to escape the ``` and the {r, eval=FALSE} . 回答1: Maybe if you evaluate this: ```{r comment=NA} cat("```{r, eval