knitr

Include Rmd appendix after references

 ̄綄美尐妖づ 提交于 2019-12-12 07:29:36
问题 My question is linked to this one. I wish to include my appendix after my references so I am using the after_body tag in my yaml, however I need to be able to knit my appendix.Rmd file. I have tried the following: after_body: "`r knitr::knit('appendix.Rmd')`" however this attempts to knit the appendix.Rmd file before the actual report and therefore fails as it does not have the required libraries or objects in memory. 回答1: In order to have appendices after the references, you simply include a

R knitr PDF problems with \includegraphics

放肆的年华 提交于 2019-12-12 07:25:24
问题 Using a new empty .rmd document, this code works: ![](RainbowDolphin.png) \begin{center} \includegraphics[width=4in]{RainbowDolphin.png} \end{center} But without the first line, it doesn't: \begin{center} \includegraphics[width=4in]{RainbowDolphin.png} \end{center} I get an error: ! Undefined control sequence. l.71 \includegraphics pandoc.exe: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 In addition: Warning message: running command '"C:/Program

Specifying multiple simultaneous output formats in knitr

懵懂的女人 提交于 2019-12-12 07:12:23
问题 I would like to be able to specify multiple output formats at the same time, for instance html_document and a pdf_document. I know that this can be done very simply with something like --- output: [html_document, pdf_document] --- I might have some of that syntax off, but I can not seem to find the documentation anywhere. I have recently discovered knitr-bootstrap and love it. It is what I have been looking for to be able to dynamically hide my code and output blocks. Unfortunately, by

R-Markdown - kableExtra package - format = 'latex' not working

て烟熏妆下的殇ゞ 提交于 2019-12-12 04:59:22
问题 Using the kableExtra documentation. inside RMardown I am running: ```{r} library(knitr) library(kableExtra) dt <- mtcars[1:5, 1:6] kable(dt, format = "rmarkdown") ``` this actually outputs a table but I also get the following in the console: Error in kable_rmarkdown(x = c("Mazda RX4", "Mazda RX4 Wag", "Datsun 710", : could not find function "kable_rmarkdown" when I switch to: ```{r} library(knitr) library(kableExtra) dt <- mtcars[1:5, 1:6] kable(dt, format = "latex") ``` I get no error and no

R read.csv from URL error in knitr

最后都变了- 提交于 2019-12-12 04:55:33
问题 When I run this code in the R console, it works fine: read.csv('https://courses.edx.org/c4x/MITx/15.071x_2/asset/WHO.csv') But when I try to put in into an R markdown document and knit it, I get the following: Error in open.connection(file, "rt") : cannot open the connection Calls: <Anonymous> ... eval -> read.csv -> read.table -> open -> open.connection Execution halted I also tried using http and url() , but neither helped read.csv('http://courses.edx.org/c4x/MITx/15.071x_2/asset/WHO.csv')

R FlexDashboard ggiraph chart not showing on second page of dashboard when using IE 11

橙三吉。 提交于 2019-12-12 04:31:14
问题 I have a multi-page R FlexdashBoard and I am trying to use ggiraph to create some interactive charts. They show up fine on the first page of the dashboard, however on the second page the SVG graphics do not show up until I hit refresh then the charts on the first page disappear. Also the text in the SVG graphics seems to only display intermittently. I only have this error in Internet Explorer - everything works fine in Chrome. The following code should recreate this error. Any help would be

Compile .Rnw file with command

一笑奈何 提交于 2019-12-12 03:19:10
问题 I have .Rnw file which generates me a report. In RStudio you compile it with button 'Compile PDF'. But is there a way to compile this file with command in script and pass one character variable? I tried to use function knit() but it only produces .tex file and I would like to obtain also pdf. Thanks for your help in advance! 回答1: The function knit2pdf in the knitr package does the trick ;) 来源: https://stackoverflow.com/questions/32115713/compile-rnw-file-with-command

How to layout character value within R chunk

若如初见. 提交于 2019-12-12 03:18:49
问题 In the knitr package I like the kable function. It gives a nice layout of tables and data frame like objects even as it is called from within an R code chunk. Now I want to do the same thing with a character value. Is there a function that gives a kable-like output ("kprint") that can be formated? knitr::kable() # exists for tables knitr::kprint() # does a function like this exists for character values? This is what I get now: print("character value") # within the R Chunk Output in generated

making a two column text block in ms-word with knitr

余生颓废 提交于 2019-12-12 02:58:58
问题 I'm trying to recreate an existing letter, for bulk generation. I'm using knitr and a reference document in the YAML for styling of the output doc. The whole thing has gone pretty well, except for the two column address block. I have tried kable, pasting the strings with \t tabs between, and playing with the formatting of the reference doc. No dice. This is the output I want (obviously without the underscores...) : Date Client: Foo & Bar____________________ Client's Client: Bar Address: 1234

Panel with different graphic packages figures

眉间皱痕 提交于 2019-12-12 02:49:34
问题 I hope the question is correctly stated. I would like to create, for didactic purposes, a knitr document where the outputs of the R base graphics system and the outputs of the Lattice package are compared in a panel. Consider a numeric vector: ```{r dataload} e2 <- c(72, 79, 81, 80, 63, 62, 89, 90, 50, 78, 87, 97, 55, 69, 97, 87, 88, 99, 76, 78, 65, 77, 88, 90, 81) ``` I tried to produce a panel with the following code: ```{r plots} par(mfrow = c(1,2)) #Set 1 row 2 columns panel hist(e2)