r-markdown

Rmarkdown table with cells that have two values

一世执手 提交于 2020-01-01 17:03:10
问题 I want to use rmarkdown to make a table where each cell has two values, for example 3.1 (0.05) or 78 ± 23.3 . These kinds of tables are pretty common in scientific literature (like ones with bold values), where we want to compactly show mean and standard deviation, or a value plus-minus some error term. So it would be useful to have a simple way to produce them when using Rmarkdown. For example: # my table mtcars mpg cyl disp hp drat wt qsec vs am gear carb Mazda RX4 21.0 6 160.0 110 3.90 2

Knitting RMarkdown with ggvis to Word

家住魔仙堡 提交于 2020-01-01 11:59:10
问题 When I try to knit a RMarkdown document with ggvis plots to Word, I get the following message from Rstudio. Error: Functions that produce HTML output found in document targeting docx output. Please change the output type of this document to HTML. Execution halted Does there exist an elegant solution (without too much effort) to make this possible, perhaps using export_png and vg2png ? 回答1: Here is an example: ```{r setup, include=FALSE} library(dplyr) library(ggvis) ``` The following table

Incorporate Leaflet map in revealjs presentation within R

坚强是说给别人听的谎言 提交于 2020-01-01 09:54:38
问题 I'm trying to add a Leaflet map with tiles to a revealjs_presentation created in R. This map renders fine in ioslide or html format, but not in the revealjs_presentation format (main problems: all fonts are much too large and the map has strange artifacts around polygon boundaries when selected). Because the map works well in other output formats I suspect the issue has to do with some kind of CSS incompatability between revealjs_presentation and leaflet. In order to isolate the two sets of

Incorporate Leaflet map in revealjs presentation within R

大城市里の小女人 提交于 2020-01-01 09:51:14
问题 I'm trying to add a Leaflet map with tiles to a revealjs_presentation created in R. This map renders fine in ioslide or html format, but not in the revealjs_presentation format (main problems: all fonts are much too large and the map has strange artifacts around polygon boundaries when selected). Because the map works well in other output formats I suspect the issue has to do with some kind of CSS incompatability between revealjs_presentation and leaflet. In order to isolate the two sets of

rmarkdown: how to use multiple bibliographies for a document

跟風遠走 提交于 2020-01-01 09:43:19
问题 [My environment: Win 7 Pro / R 3.2.1 / knitr_1.12.3 / R Studio Version 0.99.892] I am trying to write an article in .Rmd format using R Studio, Knit -> PDF, and I've been following http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html for details of how to get pandoc and pandoc-citeproc to produce a References section and citations in the text. My BibTeX references are in several different .bib files, which, when using LaTeX in .Rnw files, are all found in my local texmf

How to use Cairo PNGs in R Markdown

好久不见. 提交于 2020-01-01 08:44:49
问题 There are many advantages to using Cairo to save R graphics (see here, for example). When saving PDFs, for instance, the cairo_pdf device correctly embeds custom fonts. Using the cairo_pdf graphics device is easy with ggplot-based graphics with ggsave() : library(ggplot2) ugly_plot <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + labs(title = "Some data about cars") + theme_gray(base_family = "Papyrus") ugly_plot ggsave(ugly_plot, filename = "ugly_plot.pdf", width = 4, height = 2.5,

Embed Rmarkdown with Rmarkdown, without knitr evaluation

我与影子孤独终老i 提交于 2020-01-01 08:02:31
问题 I want to demonstrate how to write RMarkdown, where said RMarkdown demonstration is embedded within an RMarkdown document used to create the course material. Within this fenced code block, I don't want knitr to execute the chunk. I want to put something like this into my "top level" Rmarkdown document, and have everything that's between the outer fences be printed verbatim in fixed width in the output HTML document, rather than having knitr evaluate the inner embedded R code chunk and inline

How to wrap code and the output in markdown (.Rmd)

烈酒焚心 提交于 2020-01-01 07:59:47
问题 In my documents in r parts I use long codes like: ```{r} output <- "very long query for example url to some website............................................." output ``` Is there any way not to make R wrap the code automatically, let's say after 60 characters? I tried tidy=TRUE, tidy.opts=list(width.cutoff=60) option but it doesn't work. And I want the same with output, because the output of my query is some text. I want to display the whole content in many lines, not just the begining in

Add line numbers to text content of a rendered rmarkdown html document

一世执手 提交于 2020-01-01 05:19:07
问题 I am writing a report in Rmarkdown which shall be rendered in html because it contains Rshiny chunks. Is there any way I can add line numbers to the file? Importantly I need line numbers for the text and not for the code chunks as asked here. I wonder if it is possible to add some CSS to the .Rmd file below but wouldn't know how to do that. --- title: "Title" author: "Yourname" date: "June 16, 2016" output: html_document runtime: shiny --- This R Markdown document is made interactive using

RMarkdown collapsible panel

谁都会走 提交于 2020-01-01 00:42:11
问题 As I am preparing tutorials for students, I need a way to hide content in collapsible panels which can be revealed by clicking on a button. I have got this to work using the code below. The RMarkdown file looks like this: --- title: Collapsible Panel output: html_document: theme: flatly highlight: tango --- <p> <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample1" role="button" aria-expanded="false" aria-controls="collapseExample1"> Click For Answer </a> </p> <div class=