r-markdown

knitr/Rmd: page break after n lines/n distance

邮差的信 提交于 2019-12-03 01:58:29
Let me caveat by saying that this may be better suited as an html/css question but (a) I'm not too familiar with those techniques and (b) I wanted to keep it all in the family (R family) if possible. I would like to use knitr to write academic style reports ( APA 6 type guidelines ) using Rmarkdown. I've got most aspects worked out but not page breaking. I can manually set page breaks with something like: # report ```{r setup, include=FALSE} # set global chunk options opts_chunk$set(cache=TRUE) ``` ------ ## Page 1 ```{r plot1} plot(1:10, 1:10) ``` ------ ## Page 2 In the following .Rmd I'd

Is it possible to have sortable (Interactive) table in rMarkdown?

三世轮回 提交于 2019-12-03 01:29:46
I am using kable() from knitr package to show a table on a html document. Is it possible to make it sortable? Some sample code, --- title: "Test" output: html_document --- ```{r, echo=FALSE, comment=""} kable(data.frame("a"=1:10,"b"=11:20),digits=2) ``` The package DT ( https://github.com/rstudio/DT ) is an R interface to the JavaScript library DataTables . You can use it in R Markdown, e.g. ```{r} DT::datatable(iris) ``` 来源: https://stackoverflow.com/questions/27120002/is-it-possible-to-have-sortable-interactive-table-in-rmarkdown

How can I use Emacs ESS mode with R markdown?

狂风中的少年 提交于 2019-12-03 01:28:47
问题 Is there a way to configure Emacs so that it recognizes (and allows execution of) R code chunks within R markdown (.Rmd) files similar to the way it recognizes code chunks in .Rnw (Sweave) or .org (org-mode) files? 回答1: polymode is being developed which does/will allow you to write markdown with R chunks (for processing with knitr ). Instructions for setting up polymode+rmarkdown are in the README It is not yet done, but is progressing. See also this discussion on the ess-help mailing list

How to send R markdown report in body of email?

ぐ巨炮叔叔 提交于 2019-12-03 01:21:21
问题 update: Brandon Bertelsen's answer : Brandon's answer produces the following output. It doesn't produce nice tables or highlight code like Rstudio does, and it crashes on some html files with unicode, so I'm not using it to automate my email reports. My current approach is to compile with Rstudio to html, open the html document in chrome, and then copy and paste the html document into gmail. This works pretty well, see this gist: https://gist.github.com/nelsonauner/a68b5a808c232ce7817e

Plots in beamer slides converted from .md by pandoc are extremely large

流过昼夜 提交于 2019-12-03 01:13:24
Normal plots generated by R chunks in R markdown files are exactly there when converted to html slides or pdf. However, when they are converted to beamer slides by pandoc -t beamer ex.md -V theme:Warsaw -o beamer.pdf , the plots become extremely large, especially for those generated by par(mfrow=c(n,m)) , in which case only a little part of the plot is displayed. I tried to fix by setting the chunk option dev='pdf' , but it doesn't work out. The plot in html is The plot in beamer is The development version of pandoc includes some code in the beamer template that should scale images to the

Poor resolution in knitr using Rmd

可紊 提交于 2019-12-03 01:11:08
I have a .Rmd file and I am trying to create a .docx file via the function pandoc. I want to have a figure with final resolution of 504x504 pixels (i.e., 7x7inch with 72dpi). Unfortunately, the default 72 dpi is too poor in quality, and I would like to increase it to, say, 150 dpi without altering the final resolution (so it will already have the correct size within the .docx file). If I keep options fig.width and fig.height=7 and set dpi=150, I get the quality I want but the final resolution increases and the figure blows outside the .docx margins. I tried playing with the arguments out.width

Difference between R MarkDown and R NoteBook

给你一囗甜甜゛ 提交于 2019-12-03 00:30:21
问题 I am trying to understand at a high level what the differences between R Markdown and R NoteBook . I know they are interrelated but I would like to figure out how they are related. My understanding is this: I know R Notebooks are really R Markdown documents but I am confused about the terminologies. RStudio new file option has both R Markdown and R NoteBook and selecting either of them opens an R Markdown file but with minor differences. So just trying to figure out why are there two options

Relationship between R Markdown, Knitr, Pandoc, and Bookdown

流过昼夜 提交于 2019-12-03 00:24:01
问题 What is the relationship between the functionality of R Markdown, Knitr, Pandoc, and Bookdown? Specifically what is the 'division of labour' between these packages in converting markup documents with embedded R code (e.g. .Rnw or .Rmd ) into final outputs (e.g. .pdf or .html )? And if Knitr is used to process RMarkdown, what does the rmarkdown package do and how is it different to the markdown package ? 回答1: Pandoc Pandoc is a document converter. It can convert from a number of different

Include Rmd appendix after references

雨燕双飞 提交于 2019-12-02 23:54:13
My question is linked to this one. I wish to include my appendix after my references so I am using the after_body tag in my yaml, however I need to be able to knit my appendix.Rmd file. I have tried the following: after_body: "`r knitr::knit('appendix.Rmd')`" however this attempts to knit the appendix.Rmd file before the actual report and therefore fails as it does not have the required libraries or objects in memory. In order to have appendices after the references, you simply include a div with id="refs" which tells pandoc where to include the references section. For example: ```{r, child =

How to add an interactive visualization to R markdown

落花浮王杯 提交于 2019-12-02 23:42:55
My question is I want to integrate a d3.js visualization to my markdown rather than a link pointing to the visualization on external website. Is there a way to achieve that? To accomplish adding nonlocal javascript such as d3.v3.min.js to our Rmd, there are a couple ways to do it. If you are looking to include local copy of d3 , it is much easier. This is my favorite way. If for some reason, you would like to see the others, I will be happy to show them. Note: I am still experimenting. --- title: "rmarkdown example with external js" output: html_document: self_contained: false keep_md: true