r-markdown

R Markdown Inline LaTeX Equations: `$` … `$` vs `\(` … `\)`

大城市里の小女人 提交于 2021-02-17 04:51:58
问题 --- title: "esc" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` A. An amount between $5 and $10. B. An amount between \$5 and \$10. C. An amount between \\$5 and \\$10. X. An equation $1 and 1 = 2$. Y. An equation \$1 and 1 = 2\$. Z. An equation \\$1 and 1 = 2\\$. I've got a similar, but different question here. Please comment if I need to add clarification to differences. I'm asking two different questions and hope that's obvious. Anyways, the

R Markdown - Positioning table and plot side by side

大兔子大兔子 提交于 2021-02-14 14:03:12
问题 I am using R Markdown to output to pdf, and I am trying to get a table and a plot aligned side by side horizontally. I can get fig.align = "right" to align the plot to the right of the page, but it is plotted under the table (formatted with kable ) and not side by side with it. Any tips? 回答1: Here is a way using the TeX package floatrow : --- title: "Untitled" header-includes: - \usepackage{floatrow} output: pdf_document: keep_tex: true --- \newfloatcommand{btabbox}{table} \begin{figure}[H]

R Markdown - Positioning table and plot side by side

末鹿安然 提交于 2021-02-14 14:01:43
问题 I am using R Markdown to output to pdf, and I am trying to get a table and a plot aligned side by side horizontally. I can get fig.align = "right" to align the plot to the right of the page, but it is plotted under the table (formatted with kable ) and not side by side with it. Any tips? 回答1: Here is a way using the TeX package floatrow : --- title: "Untitled" header-includes: - \usepackage{floatrow} output: pdf_document: keep_tex: true --- \newfloatcommand{btabbox}{table} \begin{figure}[H]

Tabs not rendering when knitting rmarkdown to html

自闭症网瘾萝莉.ら 提交于 2021-02-13 16:04:40
问题 I've been using rmarkdown and knitr to create html output. Quite suddenly, the {.tabset} function seems to have stopped working when knitting, and documents render as they would without this option. Here is a simple example that does not work as it should on my system. --- title: "Plot Tabs" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ## Title {.tabset .tabset-fade .tabset-pills} ### tab 1 ```{r} plot(cars) ``` ### tab 2 ```{r} plot(pressure)

Tabs not rendering when knitting rmarkdown to html

ⅰ亾dé卋堺 提交于 2021-02-13 16:04:25
问题 I've been using rmarkdown and knitr to create html output. Quite suddenly, the {.tabset} function seems to have stopped working when knitting, and documents render as they would without this option. Here is a simple example that does not work as it should on my system. --- title: "Plot Tabs" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ## Title {.tabset .tabset-fade .tabset-pills} ### tab 1 ```{r} plot(cars) ``` ### tab 2 ```{r} plot(pressure)

kableExtra : How can i set to bold the biggest value of the row?

↘锁芯ラ 提交于 2021-02-11 15:17:52
问题 Suppose i have a table that looks like : x = matrix(runif(10*5),nrow=10,ncol=5) When i display the matrix using kableextra , i want the highest value, per row, of say the last 2 rows, to be bolded. I looked at this document https://rdrr.io/cran/kableExtra/f/inst/doc/awesome_table_in_pdf.pdf a lot and i did not found how to use cell_spec correctly to perform this goal. 回答1: I thought this would be easier than it turned out to be. As far as I can see, this is how to do it: --- title: "Untitled"

verticaly center table grobs in rmarkdown pdf

試著忘記壹切 提交于 2021-02-11 14:54:59
问题 I want to have my table grobs aligned to the top of each other but verticaly centered to the page with respect to the longest table. I need this to be automatic with tables of different lengths. This is what I have to vertically align them with each other as shown by @baptiste here. --- output: pdf_document geometry: - paperwidth=13.333in - paperheight=7.5in - margin=.5in --- ```{r, echo=F, fig.align='center'} library(magrittr) library(gridExtra) library(gtable) library(grid) # from https:/

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :

試著忘記壹切 提交于 2021-02-11 14:32:22
问题 When I knit my R Markdown document to pdf, some of my pages have this Error ## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : See screenshot below. What could be the problem? I am not using any new fonts and the laptop is a mac. 回答1: You are using an en-dash; for some reason there are specific bugs for this character. See R -e 'library(ggplot2); qplot(Sepal.Length, Petal.Length, data=iris, main="Big–booté")' open Rplots.pdf As you can see, the “é” characters are

Change the font of all ggplot-outputs once in code instead of with every plot? [duplicate]

与世无争的帅哥 提交于 2021-02-11 13:53:18
问题 This question already has answers here : How to set themes globally for ggplot2? (3 answers) Closed 9 months ago . Working with a quite huge R Markdown document, I was wondering whether it is possible to define the the font of my ggplots once in some kind of global setting? Just like I can use theme_set() to define theme_minimal() for all the plots in the document. I tried adding something like this, but it threw an error: theme_set(text = element_text(size=12, family="Times New Roman")) Is

Rendering multiple parametrized Rmarkdown files by render_function() fails

痴心易碎 提交于 2021-02-11 12:41:44
问题 I wrote a parametrized report that will create individual reporting for ~120 centers in two different languages. The reports are created by the knit-button so far (which works perfectly fine). Inspired by @djnavarro's tweet (https://twitter.com/djnavarro/status/1101623527872970754) I tried writing a function to render multiple parametrized reports in one command, however, the function fails with Error as shown in the minimal reprex below: The .Rmd-file called summary_cyl.Rmd --- output: pdf