r-markdown

How to render HTML from RMarkdown without javascript in output

戏子无情 提交于 2019-12-04 19:11:54
问题 Even the simplest rmarkdown document when rendered seems to create an html document that includes javascript. I am looking to create html that can be the body of an email. Is there a way to render markdown with no javascript in the resulting html? There is nothing special about the following, it is just a generic example: --- title: "Sample" author: "JKGrain" date: "March 31, 2015" output: html_document --- This is an R Markdown document. Markdown is a simple formatting syntax for authoring

Rmarkdown - how to remove grey background on output

妖精的绣舞 提交于 2019-12-04 18:53:42
I am experiencing a slightly irritating problem, which is that I am not able to remove the grey text from output (please see picture below). I've searched for a solution, but is restricted by my lack of knowledge about the proper terms, and therefore I am not able to find any solutions. I know this can be somehow bypassed by using only one "`", yet I need the triple "```" in order to run my code interpreting rows. The grey background on output --- title: "Untitled" output: word_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r, echo=FALSE} hej <- ("test")

How to add multiple figures across multiple pages in a chunk using knitr and RMarkdown?

为君一笑 提交于 2019-12-04 18:07:03
问题 I am using a for loop to create multiple big figures across multiple pages in one chunk with knitr and rmarkdown. It works fine for word and html outputs, but has one problem in pdf output. This is a minimal RMarkdown example to reproduce my problem. --- title: "Knitr test" date: "6 April 2015" output: pdf_document --- ```{r, echo=FALSE, fig.width=6.5,fig.height=10} library(ggplot2) for (i in seq(1, 4)){ p <- ggplot(cars, aes(speed, dist)) + geom_point() print(p) } ``` The generated pdf file

How do I access the data from a file passed as parameters in a RMarkdown document?

混江龙づ霸主 提交于 2019-12-04 18:06:51
问题 Following the last example on RMarkdown's Parametrized Reports page, I am trying to use the Shiny interface to select my input file with the following code inside the YAML header: params: data: input: file label: 'Input dataset:' value: myData.csv The Shiny interface shows up and I get to browse for a file, but when I try to access it further down in the R code via read.csv(file=params$data, header=TRUE) , I get the following message: Error in file(file, "rt") : cannot open the connection How

Howto include js dependencies of DT datatable in Rmarkdown using knitr and pandoc

只愿长相守 提交于 2019-12-04 16:41:06
Is there a way to compile RMarkdown documents with datatables produced by DT outside of RStudio? I'm trying to include a datatable widget in an RMarkdown document that I then want to convert to html using knitr and pandoc. This works fine with RStudio but if I try to do the same with knitr and pandoc I'm unable to get a working html file. Here is a minimal example of an Rmd file that works with RStudio but not otherwise: --- title: "Minimal DT example" --- <style type="text/css"> table, table th, table td { border: none; } </style> ```{r} library(DT) datatable(iris) ``` Which I would then like

How to remove white space above and below image in R Markdown?

依然范特西╮ 提交于 2019-12-04 16:29:19
问题 I want to export a .Rmd file primarily as a latex pdf. This is the code that I'm currently using ```{r ,fig.cap="caption",fig.env='figure', fig.width=10, fig.height=10,echo=FALSE, results='asis', warning=FALSE, strip.white=TRUE} library(png) library(grid) img <- readPNG("filepath/overview.png") grid.raster(img) ``` As you can see, I'm already using strip.white=TRUE & fig.env='figure' but they don't seem to work. The .PNG file hasn't got any (white) spacing above or below the image. I know I

R markdown table with a caption

拥有回忆 提交于 2019-12-04 16:26:19
问题 I'm trying to create a table outside of a code chunk using normal markdown notation and to add a caption to it. Here's an example file (taken from here: --- output: pdf_document --- | First Header | Second Header | Third Header | | :------------ | :-----------: | -------------------: | | First row | Data | Very long data entry | | Second row | **Cell** | *Cell* | | Third row | Cell that spans across two columns || [Table caption, works as a reference][section-mmd-tables-table1] This

RMarkdown error in YAML

为君一笑 提交于 2019-12-04 15:44:41
问题 I watched a great webinar by RStudio the other day about RMarkdown. After the webinar they posted the code used in the demonstrations online and I wanted to check out one example. I took their code, put it in my RStudio (which says it's fully up-to-date, v0.98.978), installed or updated all the necessary packages and hit "Run Document" I receive an error which I do not understand and for which Google has been very unhelpful. What is this mysterious <document start> and how do I include it? I

Rmarkdown table with cells that have two values

空扰寡人 提交于 2019-12-04 15:39:30
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.620 16.46 0 1 4 4 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108.0 93 3

R Studio change pandoc .tex template

亡梦爱人 提交于 2019-12-04 15:07:29
I want to use a different latex template for rendering R markdown version 2. I found the following suggestions: a) location of template system.file("rmd/latex/default.tex", package="rmarkdown) b) change of YAML front matter --- ... output: pdf_document: template: mytemplate.tex --- However, his does not seem to be the correct template location for R Studio/ Pandoc, as I get the following error message: pandoc.exe: Could not find data file templates\mytemplate.tex Ok, I think I have the answer, the default directory for Pandoc can be found here: system("pandoc -v") If the folder does not exist,