r-markdown

Rmarkdown / knitr subfigure different figure sizes

断了今生、忘了曾经 提交于 2020-04-16 04:04:14
问题 I am trying to achieve different heights and widths for subfigures in Rmarkdown. I was hoping that just providing fig.height and fig.width with a vector each would work, as this does seem to work for out.height and out.width --- title: "Untitled" output: pdf_document header-includes: - \usepackage{subfig} --- ```{r, echo = FALSE, fig.height = c(1,2,3), fig.width=c(1,1,1), fig.cap='Caption', fig.subcap=c('Subcaption 1', 'Subcaption 2', 'Subcaption 3')} library(ggplot2) df <- data.frame( x =

Rmarkdown / knitr subfigure different figure sizes

北战南征 提交于 2020-04-16 04:04:08
问题 I am trying to achieve different heights and widths for subfigures in Rmarkdown. I was hoping that just providing fig.height and fig.width with a vector each would work, as this does seem to work for out.height and out.width --- title: "Untitled" output: pdf_document header-includes: - \usepackage{subfig} --- ```{r, echo = FALSE, fig.height = c(1,2,3), fig.width=c(1,1,1), fig.cap='Caption', fig.subcap=c('Subcaption 1', 'Subcaption 2', 'Subcaption 3')} library(ggplot2) df <- data.frame( x =

change mathjax renderer in R notebooks (with “self_contained: false”)

大城市里の小女人 提交于 2020-04-16 03:54:07
问题 I am creating R notebooks that contain equations. I am using RStudio 1.2.5033 on Windows 10, R 3.5.1, and rmarkdown 2.1. When my R notebooks are rendered as HTML, MathJax (v2.7.2) uses the "HTML-CSS" output processor to render the equations. But I think that the output from the "CommonHTML" output processor looks better. So I want to include a directive, in my R notebooks, that forces MathJax to use the CommonHTML output processor. How may I do this? If I were rendering an ordinary R Markdown

Output several regression tables into multiple pages of a Word document in R

≡放荡痞女 提交于 2020-04-14 07:28:19
问题 My goal is to create a multi-page Microsoft Word document with many formatted regression table outputs on consecutive pages. Ideally this would be done using R Markdown. I have had some luck making nicely formatted regression tables in word using sjPlot::tab_model So for example, I can do mod2 <- lm(Petal.Length ~ Species + Petal.Width, data=iris) sjPlot::tab_model(mod2, file = "~/Desktop/model2.doc") to create a nice-looking regression table in a new Word document. If I do mod3 <- lm(Petal

Looping headers/sections in rmarkdown?

非 Y 不嫁゛ 提交于 2020-04-13 17:48:20
问题 I am trying to generate a loop with sections/headers that are followed by a figure in rmarkdown. I understand that I can use cat("## xyz") to generate a new header in my chunk but I observe some odd behaviour. --- title: "Untitled" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = F) ``` Version 1: (does not work) ```{r, results='asis'} for (i in 1:5) { cat("\n") cat("## This is a heading for ", i, "\n") plot(pressure) cat("\n") } ``` Version 2: (does not work

Looping headers/sections in rmarkdown?

家住魔仙堡 提交于 2020-04-13 17:48:05
问题 I am trying to generate a loop with sections/headers that are followed by a figure in rmarkdown. I understand that I can use cat("## xyz") to generate a new header in my chunk but I observe some odd behaviour. --- title: "Untitled" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = F) ``` Version 1: (does not work) ```{r, results='asis'} for (i in 1:5) { cat("\n") cat("## This is a heading for ", i, "\n") plot(pressure) cat("\n") } ``` Version 2: (does not work

GoogleVis chart not rendering in Rmarkdown

给你一囗甜甜゛ 提交于 2020-04-13 06:58:07
问题 Outside of Rmarkdown the stand alone googleVis chart works fine, but when I plug it in the Rmarkdown file I am receiving just the Rmarkdown Code: Viewer Output: > TEST H 4/13/2016 require(googleVis) Loading required package: > googleVis Welcome to googleVis version 0.5.10 Please read the Google > API Terms of Use before you start using the package: > https://developers.google.com/terms/ > > Note, the plot method of googleVis will by default use the standard > browser to display its output.

Caption above figure in html Rmarkdown

谁说我不能喝 提交于 2020-04-13 05:59:21
问题 Is it possible to move the caption above my figure when knitting to HTML in RMarkdown? It seems that it is possible in PDF, ie when knitting to PDF, but I can't figure out how to replicate this for HTML. I am using bookdown to number figures. When I run something like this: ```{r fig.cap= "caption"} df <- data.frame(letter = letters[1:5], value = 1) ggplot(df, aes(as(factor(1), value, fill = letters))) + geom_bar(stat = "identity") ``` the caption is displayed at the bottom of the figure, but

R notebooks don't render properly when “self_contained” is FALSE because the “files” directory is deleted after rendering

落爺英雄遲暮 提交于 2020-04-11 18:27:51
问题 It is sometimes desirable to create an R notebook that isn't self-contained. For example, one may want to load Mathjax from a local file of one's choosing, and to do so, self_contained must be FALSE. But I find that, by default, even the simplest R notebooks don't render properly when the YAML header includes self_contained: FALSE . Here is a minimal example: --- title: "Notebook, not self-contained" output: html_notebook: self_contained: false --- Hello. When this file is rendered with the

IN R MARKDOWN, How Can I add a background image (HTML output)?

流过昼夜 提交于 2020-03-25 19:11:11
问题 I'm trying to put an image as background for my R markdown document (HTML output) Instead of the black background. I Was searching everywhere in the documentation on how to do this but I can't seem to find any answer as it's my first time working with R Markdown. I can't seem to know how to put the background image and how to divide it that way so I can have my content in the middle I'm also trying to attach a Hyperlink to tablist option,in the Picture2 as you can see "Source" as for when I