r-markdown

How to add list of figures and list of tables to the table of content with R markdown and bookdown

别来无恙 提交于 2021-01-27 17:36:29
问题 I have a report (pdf output) where I want to add bibliography, list of figures and list of tables to the appendix. And I want those three elements to appear in the table of content. I add the bibliography by adding bibliography: bibliography.bib to my yaml header. The list of figures and the list of tables I add with LaTex directly. My appendix therefore looks like: # Literature {-} \listoffigures \listoftables This nearly works: bibliography, list of figures and list of tables are rendered

How to “box” the output of “summary()” in Rmarkdown

心已入冬 提交于 2021-01-27 07:43:32
问题 I have seen this post: How to create R-markdown sections inside a R code chunk? With proper code display and one of the responders, Cedric, impressed me with the way he or she boxed the output of summary() command in R. I understand that the user used Sweave to create such a great output. I am curious that whether there is a way to use Knit to output to a PDF file in the similar fashion. Thank you! 回答1: There's nothing special about Sweave vs. R Markdown here. You can copy and paste the LaTeX

kableExtra: short.caption argument does not work if several dataframes are included in one table

孤者浪人 提交于 2021-01-27 07:43:32
问题 I have recently noticed that kable() from the kableExtra-package behaves oddly if more than one dataframe is included in the command. Short.caption argument is not used In this example, I create two data-frames and want to include them into one table. library(kableExtra) t1 <- c(68, 48, 50, 113, 98, 94) t2 <- c(26, 16, 22, 30, 16, 12) Group <- c("b1", "b2", "b3", "b4", "b5", "b6") cows <- data.frame(Group, t1, t2) colnames(cows) <- c("Group", "t1", "t2") kable(list(cows[1:3,], cows[4:6,]),

How to “box” the output of “summary()” in Rmarkdown

回眸只為那壹抹淺笑 提交于 2021-01-27 07:43:18
问题 I have seen this post: How to create R-markdown sections inside a R code chunk? With proper code display and one of the responders, Cedric, impressed me with the way he or she boxed the output of summary() command in R. I understand that the user used Sweave to create such a great output. I am curious that whether there is a way to use Knit to output to a PDF file in the similar fashion. Thank you! 回答1: There's nothing special about Sweave vs. R Markdown here. You can copy and paste the LaTeX

Change second tabset on click in flexdashboard

六眼飞鱼酱① 提交于 2021-01-27 05:47:41
问题 I'm working on a self-contained flexdashboard project and I'm wondering if it's possible when a user clicks to a new tab in one tabset, it changes to a new tab on a second tabset as well. So for example, when you click on "Chart B1" below, I would also like to change view to "Chart B2" in the second column. And clicking on "Chart A2" would change back to "Chart A1", etc. etc. --- title: "Untitled" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill --- ```{r

More flexible citation formats

巧了我就是萌 提交于 2021-01-27 05:44:17
问题 I love to use citations in my r bookdown projects. The format is not very flexible, I can use @citeID to get "Author(Year)" or [@citeID] to get "(Author Year)". Sometimes I only need "(Year)" or "Year" or I may only need "Author Year" with no parentheses at all. Finally I need to add a page reference to the citation like "Author (Year:Pages)" Can anybody give me a hint, where the relevant code sits in the source so that I can start adding some cite-formats as described above? 回答1: There are

Strange characters in preview of R Notebook

╄→尐↘猪︶ㄣ 提交于 2021-01-27 05:24:39
问题 When I preview my R Notebook, the HTML output contains strange characters. This chunk code and output gets rendered in HTML as How should I fix this? SessionInfo: R version 3.6.0 (2019-04-26) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17763) Matrix products: default locale: 1 LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C [5] LC_TIME=Dutch_Netherlands.1252 other attached packages: 1 plotly_4

Strange characters in preview of R Notebook

荒凉一梦 提交于 2021-01-27 05:24:23
问题 When I preview my R Notebook, the HTML output contains strange characters. This chunk code and output gets rendered in HTML as How should I fix this? SessionInfo: R version 3.6.0 (2019-04-26) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17763) Matrix products: default locale: 1 LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C [5] LC_TIME=Dutch_Netherlands.1252 other attached packages: 1 plotly_4

How can I specify rmarkdown to use python3 instead python 2?

限于喜欢 提交于 2021-01-27 02:55:39
问题 I am trying to run python as rmarkdwon code chunks. I was sucessfull but rmarkdown by default uses python2 and I want it to use python 3. I am running it on Ubuntu with python 2.7.6 installed and I installed anaconda with pytthon 3.5, which is the one I want rmarkdown use. Here is the code and output of the python chunk in rmarkdown ```{python} import sys print (sys.version) ``` and the output: 2.7.6 (default, Jun 22 2015, 17:58:13) Any ideas? 回答1: You can add engine.path = '/path/to/python3'

How can I specify rmarkdown to use python3 instead python 2?

与世无争的帅哥 提交于 2021-01-27 02:54:59
问题 I am trying to run python as rmarkdwon code chunks. I was sucessfull but rmarkdown by default uses python2 and I want it to use python 3. I am running it on Ubuntu with python 2.7.6 installed and I installed anaconda with pytthon 3.5, which is the one I want rmarkdown use. Here is the code and output of the python chunk in rmarkdown ```{python} import sys print (sys.version) ``` and the output: 2.7.6 (default, Jun 22 2015, 17:58:13) Any ideas? 回答1: You can add engine.path = '/path/to/python3'