r-markdown

Create a table of contents (toc) in a post with blogdown package

心已入冬 提交于 2020-02-25 05:47:45
问题 I know the short answer, add the following in the metadata toc: TRUE But when I create a post with the blogdown package that have a table of content, I have problems with the url (redirection) behind the table options. The links for the table of content are of the following form: http://home-website/#tree-terminology Instead to be: http://home-website/post_name/#tree-terminology How can reference the name of the post correctly in the url to generate the proper url in the table of content? In

Mermaid diagrams not rendering correctly in Rmarkdown xaringan presentations

落花浮王杯 提交于 2020-02-25 05:00:07
问题 I am attempting to make some simple flowcharts in an Rmarkdown html presentation I am rendering with xaringan. I'm drawing mermaid diagrams using the DiagrammeR package. However, although the charts display correctly in the Rstudio viewer the styling does not appear in the presentation output. For instance DiagrammeR::mermaid(" graph LR; A((Orange)) --> B((Grey)); classDef orange fill:#f96; classDef grey fill:#d3d3d3; class A orange; class B grey; ") generates one orange node and one grey

In R Markdown, how do I create citations to references with a hyperlink?

半腔热情 提交于 2020-02-25 04:06:21
问题 Now I have a RMarkdown file, when the citation for the reference is clicked, I want the reader to be navigated to the corresponding reference in the bibliography. --- title: "My Title" author: "my name" date: "2020/2/6" output: pdf_document: keep_tex: true header-includes: - \hypersetup{colorlinks = false,pdfborder={1 1 1}} bibliography: bibfile.bib --- [Stack Overflow](https://stackoverflow.com/) This is my reference[@Breiman2001]. I want the effect could be like this: this is the .bib file:

In R Markdown, how do I create citations to references with a hyperlink?

╄→гoц情女王★ 提交于 2020-02-25 04:05:10
问题 Now I have a RMarkdown file, when the citation for the reference is clicked, I want the reader to be navigated to the corresponding reference in the bibliography. --- title: "My Title" author: "my name" date: "2020/2/6" output: pdf_document: keep_tex: true header-includes: - \hypersetup{colorlinks = false,pdfborder={1 1 1}} bibliography: bibfile.bib --- [Stack Overflow](https://stackoverflow.com/) This is my reference[@Breiman2001]. I want the effect could be like this: this is the .bib file:

How to change pandoc option in R Studio

家住魔仙堡 提交于 2020-02-23 09:49:33
问题 Installing package rmarkdown in R Studio you can create docx documents using a Rmd-file and pressing the Knit Word button. The invoked command is then: "C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS hallo.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output hallo.docx --highlight-style tango Question How to add other options? I want to add: --filter ./pandoc-word-pagebreak to get: "C:/Program Files/RStudio

Scale kable table to fit page width

China☆狼群 提交于 2020-02-19 09:39:12
问题 How do you format a table in pdf using kable function? Because my output table width exceeds the width of the pdf. Here is an example: --- output: pdf_document --- ```{r} df <- cbind(mtcars[1:5,], mtcars[1:5,]) knitr::kable(df) ``` 回答1: One option is to use kable_styling from the kableExtra package. The option latex_options="scale_down" will fit the table within the paper margins. See the vignette for detailed examples on all of the formatting options. --- output: pdf_document --- ```{r setup

Knit with custom parameters

孤者浪人 提交于 2020-02-07 02:01:36
问题 I can't get rmarkdown::render to take my params argument as in https://bookdown.org/yihui/rmarkdown/params-knit.html#knit-with-custom-parameters A minimal example of an Rmd called re.Rmd: --- title: "Untitled" output: pdf_document: template: def.tex params: title: "different" --- I changed the default pandoc latex template: pandoc -D latex > def.tex $if(title)$ \title{$title$$if(thanks)$\thanks{$thanks$}$endif$} $endif$ to $if(params.title)$ \title{$params.title$$if(thanks)$\thanks{$thanks$}

Make ioslides default to widescreen

蓝咒 提交于 2020-02-06 06:42:30
问题 In ioslides you can make the slide widescreen by pressing 'w'. Is there any setting in the css or yaml header to make widescreen the default? 回答1: See the documentation. --- output: ioslides_presentation: widescreen: true --- 来源: https://stackoverflow.com/questions/58513357/make-ioslides-default-to-widescreen

Make ioslides default to widescreen

被刻印的时光 ゝ 提交于 2020-02-06 06:41:26
问题 In ioslides you can make the slide widescreen by pressing 'w'. Is there any setting in the css or yaml header to make widescreen the default? 回答1: See the documentation. --- output: ioslides_presentation: widescreen: true --- 来源: https://stackoverflow.com/questions/58513357/make-ioslides-default-to-widescreen

Formatting tables in R Markdown to export to MS Word document

半城伤御伤魂 提交于 2020-02-05 13:59:30
问题 I've started using expss in R Markdown for generating tables with the help of Knitr. I would like to automate the tables and analysis for a report I need to prepare in Microsoft Word format. When knitting to HTML, the tables look wonderful. The tables in Word are displayed as rows of plain text and does not resemble a table. Does expss support exports of tables to Word? Are there instructions on how to do it? Tables generated with kable and dplyr display correctly in Word. However, I'm