r-markdown

add vertical space above and below figures/code chunks

↘锁芯ラ 提交于 2019-12-08 05:45:37
问题 I am knitting from Rmd to PDF. I'd like to add vertical space above and below figures/code chunks to separate this content from body text. I've done this successfully for Rnw files by adding the following to my preamble see this answer: \renewenvironment{knitrout}{\vspace{1em}}{\vspace{1em}} I tried adding this line to header-includes in the yaml section of my Rmd file, but it did not work. I turned on the option to keep the interim tex file, and I see there is no knitrout environment in the

RMarkdown cannot knit: html_dependency not found

走远了吗. 提交于 2019-12-08 04:53:03
问题 I am trying to create an html file using RMarkdown (using the sample .Rmd in RStudio). When I click Knit , I am getting the following message: Error: path for html_dependency not found: Execution halted. I have tried uninstalling and reinstalling both R and RStudio, as well as all of the packages required for markdown. I am running the most current version of RStudio (1.1.383), and R (3.4.2), and all of my packages are up to date. This is not my first time using RStudio or markdown, but I

Formula's or symbols in footnotes using knitr and kableExtra

南楼画角 提交于 2019-12-08 04:00:21
问题 Does anyone know how to place a formula, a (weird) character, or words in italic within a sentence of a footnote of a table? I'm creating a pdf file with Rmarkdown and kableExtra. But stuff like $Y_{t-1}$ or $p < .001$ (since I want the p to be italic) does not work. Or should I really learn xtable? 回答1: The trick is 1. to escape latex code and special characters four times, e.g. \\\\frac , 2. to set option escape=FALSE in footnote() . --- title: "Untitled" output: pdf_document --- ```{r tab}

prevent pandoc from converting $ into mediawiki <math>

谁说我不能喝 提交于 2019-12-08 03:36:55
问题 I am converting a markdown file into mediawiki table using pandoc: content of file mtcars.md : | |c1 |c2 | |:--|:----|:--| |7 |P$A |A | |8 |AB |B | |9 |P$A |C | Then I do (I am using Ubuntu 64 bits and pandoc version 1.13.2) pandoc -t mediawiki -o mtcars.txt mtcars.md But the two $ signs are interpreted as <math>...</math> : {| ! !c1 !c2 |- |7 |P<math>A |A | |8 |AB |B | |9 |P</math>A |C |} How can I get the dollar signs instead? 回答1: The pandoc documentation says: Anything between two $

R Markdown PowerPoint Slide Customization

时光怂恿深爱的人放手 提交于 2019-12-08 03:16:50
问题 --- title: "Untitled" author: "April 2018" date: "4/9/2019" output: powerpoint_presentation --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ## Slide with Plot ```{r pressure, fig.width=30, fig.asp=0.618, out.width="200%"} plot(pressure) ``` I'm reading R Studio's guide to creating PowerPoint presentations in R Markdown. I'd like to be able to customize my slides to include two things: Stretch the image size to the full width of the slide Move the title up a bit and

How to solve R Markdown (Knit) “'closure' is not subsettable”?

删除回忆录丶 提交于 2019-12-08 03:06:17
问题 I am trying to use RMarkdown (Knit) for the first time to produce pdf. The default file (File > New File > R Markdown) works well, it shows the generated pdf when compiled. For example, the following code runs, ```{r cars} summary(cars) ``` However, if I just change cars with "myData," it does not compile and shows, Error in object[[i]] : object of type 'closure' is not subsettable Calls: <Anonymous> ... withVisible -> eval -> eval -> summary -> summary.default Execution halted I have "myData

For Loop for Creating Multiple Tables using knitr and kableExtra packages in RMarkdown

不羁的心 提交于 2019-12-08 02:39:20
问题 I need to create multiple tables in RMarkdown and style it with the kableExtra package. As an example, I have the iris dataset. My first table displays the first 20 rows, my second table the next 20 rows, and my third table next 20 rows... Below is the code: --- title: "" output: pdf_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ```{r} library(knitr) library(kableExtra) landscape(kable_styling(kable(iris[1:20, ], format = "latex", align = "c", row.names =

Issue creating model summary table using package texreg with RStudio/rmarkdown/knitr

和自甴很熟 提交于 2019-12-08 02:11:39
问题 I'm using the RStudio IDE (v 0.99.323) with rmarkdown and am attempting to produce model tables via knitr using htmlreg to produce MSWord output. Suspect I've missed something simple. The rmarkdown chunk appended below creates a separate word file 'mytable.doc' with a beautiful table. However, when I click 'Knit Word' in the RStudio IDE, the line htmlreg(m) generates html table code in the MSWord document. What am I doing wrong? Many thanks! --Dale ```{r, results='asis'} library(MASS) library

servr::jekyll() yields ready website, servr:rmdv2() does not

三世轮回 提交于 2019-12-08 01:24:19
问题 I'm basing my rmarkdown -Jekyll-Blog off of Yihui's fantastic boilerplate for using servr::jekyll(), which in turn wraps knitr . Because I want to use citations (via pandoc-citeproc , wrapped by rmarkdown ) I need to use rmarkdown::render , not knitr to, well, render the *.md s. As per the servr manual, I understand that rmdv2() should do the job, which essentially wraps/modifies jekyll() : The functions rmdv1() and rmdv2() are similar to jekyll(), and the only difference is the way to

R Markdown PowerPoint Slide Customization

孤街醉人 提交于 2019-12-07 23:43:25
--- title: "Untitled" author: "April 2018" date: "4/9/2019" output: powerpoint_presentation --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ## Slide with Plot ```{r pressure, fig.width=30, fig.asp=0.618, out.width="200%"} plot(pressure) ``` I'm reading R Studio's guide to creating PowerPoint presentations in R Markdown . I'd like to be able to customize my slides to include two things: Stretch the image size to the full width of the slide Move the title up a bit and left align it After doing some internet searches I just can't determine how to do this properly. Maybe