r-markdown

custom syntax highlighting rmd

折月煮酒 提交于 2019-12-11 11:34:52
问题 I would like to be able to customize the syntax highlighting used with RMarkdown so that I can, for example, draw attention to functions coming from a certain package. I noticed an option mentioned in the knitr NEWS document which says this option can be set via: opts_knit$set(highr.opts = list(markup = cmd_mine)) for .Rnw and .Rhtml documents. However, when I set this option in my .Rmd file (simplified here to messing with the highlight for numerical constants) ```{r setup, include=TRUE} #

Use image as table in RMarkdown?

情到浓时终转凉″ 提交于 2019-12-11 10:42:04
问题 I appreciate that what I'm trying to do will sound silly, but please bear with me. I want to insert an existing image (a PNG) of a table into an RMarkdown document that will be turned into a pdf. Is there any way I can do this and have the image treated as a table for numbering purposes? That is, obviously I could do ![A caption for my table](my_table_as_image.png) but the problem is that it will be numbered as e.g. Figure X, not Table Y. I would like it to be named/numbered as a table. Thank

How do you change the font size in RMarkdown for Knitr

空扰寡人 提交于 2019-12-11 10:34:05
问题 I created a Knitr document and I want to adjust the font size for the text that is NOT in the chunks. It currently appears too small and want to increase it. Currently I am just writing a line like this: Example text --------- And that will make it larger but I can't control the font size. This is for an HTML document 回答1: For .Rmd files, you can affect the HTML header size using different numbers of # characters, instead of the alternative underlined form which only gives you H1 and H2 sizes

Save a rmarkdown ioslides presentation as standalone website

a 夏天 提交于 2019-12-11 09:43:49
问题 I would like to save the presentation generated by knitr as a html file. Which I am able to share with people as standalone html file. If I use Run Document button in R studio (server) this generates a file with the .Rmd extension. --- title: "Standalone" author: "MarketRedesign" date: "10-7-2014" output: ioslides_presentation --- ## Slide with R Code and Output ```{r} summary(cars) ``` 回答1: When you press the knit HTML button, a HTML file IS always created by RStudio in the same directory as

Cannot Install TinyTeX package

白昼怎懂夜的黑 提交于 2019-12-11 09:14:11
问题 I’m using R, RStudio but new to r-markdown and want to produce document in pdf/latex. I was a little rebutted by the installing the complete version of MiKTeX and was relief reading the solution proposed by Yihui Xie with TinyTeX and think this is exactly the solution for (people like) me. Unfortunately, I failed to install the package and don’t understand what am I doing wrong. I carefully read the instructions on TinyTeX vignette for a “R USER” (I tried to install through R Studio). Help

RMarkdown: Tables with math notation and long text within

若如初见. 提交于 2019-12-11 08:50:01
问题 First, I gotta say I'm a total beginner using RMarkdown . Said that, I've been introducing myself into that world in order to learn how to make reports. By now I learned the basics (math notation, some text formatting) but I can't create tables the way I've done in the past. I've already created a table using knitr::kable() but without math notation: ```{r table1, echo=F, warning=FALSE, message=F} library(knitr) library(dplyr) library(kableExtra) text_tbl <- data.frame( 'Nro'=1:2, 'Obj'= c(

How to specify table stripe colors for knitr::kable?

二次信任 提交于 2019-12-11 08:13:50
问题 How was this person able to make the tables shown in this link? It doesn't look like they were passing any arguments to kable. Here is the example: 回答1: The styles of kable tables are controlled by CSS file. tbody can be used to change the colour of the content of the table, with thead able to change the header. As shown by Lee S, you can create an external CSS file. However, you can also include the CSS directly within the R Markdown file, as markdown accepts raw HTML and passes it through

Infering the size of a minipage from the containing tikz node for rmarkdown

纵然是瞬间 提交于 2019-12-11 07:46:57
问题 This is a follow-up question to Using bullets list in tikz's node label in rmarkdown. I had some TikZ code that works fine in pure LaTex but NOT when I transport it to rmarkdown where the error ! LaTeX Error: Something's wrong--perhaps a missing \item. is raised. This was solved in the answer to Using bullets list in tikz's node label in rmarkdown but another issue arises applying the solution I got in there. You can refer to the original question (Using bullets list in tikz's node label in

Inline code and inline LaTeX, R Markdown Pandoc error 43

情到浓时终转凉″ 提交于 2019-12-11 07:36:46
问题 I've run into this issue a couple times now, but whenever I try to include both inline LaTeX and inline R code in my Rmd file, I get Pandoc error 43. Never been able to find a workaround other than just manually adding in what the R code would have been. --- title: "HW4" date: "2/23/2018" header-includes: - \usepackage{amsmath} - \usepackage{amsthm} output: pdf_document --- ```{r} x_bar <- 4 ``` The blue line above is the true $\lambda = 4$, and the red line is our $\hat{\lambda}_{MLE} = \bar

Error adding images and plots in ioslides_presentation w/ Runtime: shiny on Windows

断了今生、忘了曾经 提交于 2019-12-11 07:28:45
问题 When I run the following ioslides_presentation w/ runtime: shiny at work (Windows 7 Enterprise) --- title: "Untitled" author: "Me" date: "Thursday, February 05, 2015" output: ioslides_presentation: logo: images/rstudio-ball.png runtime: shiny --- ## Slide with Plot ```{r, echo=FALSE} plot(cars) ``` I get an "invalid back reference" error when attempting to include a logo or plot into the presentation . However, if I remove runtime: shiny the presentation compiles as expected, with both the