knitr

Unable to knit pdf from Rmardown from Rstudio in Windows 10 PC

ぐ巨炮叔叔 提交于 2019-12-10 10:36:33
问题 I created a new Rmd file in the latest R and Rstudio version, and with the complete version of MiKTeX installed. In my windows 10 machine. When I tried to knit it I got the following error ! LaTeX Error: File `fancyvrb.sty' not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. <read *> l.34 \newcommand pandoc.exe: Error producing PDF Error: pandoc document conversion failed with error 43 Además: Warning message:

how to align kable and ggplot in one row (side by side) in r markdown?

自古美人都是妖i 提交于 2019-12-10 10:30:01
问题 I am trying to knit an r markdown file to pdf , but I can't align ggplot and kable in one row. I have tried following ways: cat("\twocolumn") kable_styling(position = "float_right") Below is a minimal, reproducible example --- title: "Untitled" output: pdf_document classoption: landscape --- \newpage ```{r cars, echo=FALSE, fig.width=3, fig.height=3, results="asis", message=FALSE} library(dplyr) library(knitr) library(kableExtra) library(ggplot2) dt <- split(mtcars, f = mtcars[, "cyl"]) %>%

In RMarkdown Word document, how to make table of contents appear later

二次信任 提交于 2019-12-10 10:29:25
问题 When an RMarkdown document is knit to Word, the Table of Contents (if there is one) always appears at the beginning of the document. If I want to, say, make the Table of Contents appear on the second page of the document, how do I do so? If I was knitting to HTML I could use this method, but it doesn't seem to work for Word. Meaning, I create a Word template to be used in the reference_docx YAML argument and put the Table of Contents at the bottom of this template, but when I knit a report

How to control output width when use knitr to compile to pdf?

☆樱花仙子☆ 提交于 2019-12-10 10:26:06
问题 using knitr to compile to a .Rnw document to a pdf, the width of output text in a chunk can not be resetted by out.width option. how to keep the output text in area with the background color? 回答1: The text output width in PDF is always a painful problem. It is not easy to make sure everything fits on a page. Two possible and general solutions (if you have to use LaTeX/PDF): make the white margin smaller in LaTeX, e.g. \usepackage{geometry} \geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm

Save knitr chunk to R file

試著忘記壹切 提交于 2019-12-10 09:31:39
问题 In knitr there is a read_chunk function which read external code into a chunk. Is it possible to reverse the process. That is, make a function write_chunk() which save the source code in the chunk to an R file? The file name may the same as the chunk name. 回答1: I found a solution using hooks. Add the following hook: knit_hooks$set(write_chunk = function(before, options, envir) { if (before) { fileConn<-file(paste0("chunk_",options$label,".R") ) writeLines(options$code, fileConn) close

how to add grid to table with pander?

守給你的承諾、 提交于 2019-12-10 09:31:21
问题 I am working with R, knitr and pander, and I can't find the option that would allow me to print a grid on a table with pander. I tried : pander(tableToPrint, style='grid') but it doesn't do anything, neither with this option or with 'multiline', 'rmarkdown'... I always get an horizontal line, then the column names, another horizontal line, all my data and an horizontal line. I would like to have an horizontal line between every line. Another option would be to alternate row colors. 回答1: There

how to include an abstract in a rmakdown Rmd file

ε祈祈猫儿з 提交于 2019-12-10 05:01:10
问题 In a .Rmd file with the header below, I want to include an abstract, so I tried the standard LateX article form, \abstract{This paper explores a variety of topics related to the question of testing the equality of covariance matrices in multivariate linear models, particularly in the MANOVA setting. The main focus is on graphical methods that can be used to understand features of data related to this question.} But, surprisingly (I know this seems weird), the references in my References

How can I create a self-contained html report with rmarkdown?

社会主义新天地 提交于 2019-12-10 04:24:37
问题 How can I produce an html document from a .Rmd file, with self-contained images? I am using the bsplus package along with rmarkdown to create a carousel of images. It works perfectly when I open the .html output within the .Rproj working directory, but the images are no longer displayed when I send the file to someone. Would it be possible to get a "self-contained" .html file output with the corresponding images? or should I send also all folder dependencies? Example of how the code looks

Setting HTML meta elements with knitr

*爱你&永不变心* 提交于 2019-12-10 03:19:32
问题 I'm generating HTML reports using knitr, and I'd like to include author and generation date meta tags. My Rhtml page looks something like this. <html> <head> <meta name="author" content="<!--rinline Sys.getenv('USERNAME') -->"> <meta name="date" content="<!--rinline as.character(Sys.time()) -->"> </head> <body> </body> </html> Unfortunately, after I knit("test.Rhtml") , the HTML that knitr generates is <meta name="author" content="<code class="knitr inline">RCotton</code>"> <meta name="date"

Knitr preamble error results in “pandoc document conversion failed with error 43”

冷暖自知 提交于 2019-12-10 02:56:23
问题 Rstudio Version 0.99.441; Windows 7 enterprise; knitr 1.10.5; MiKTex 0.4.5 r.1280 (2.9 64-bit) I have a an error on my office computer when trying to knit PDF's in Rstudio, there are no problems knitting to HTML or word. The problem may be related to updates because knitting used to work fine and my home computer can knit to pdf without issue, however I took my computer home to update and the problem is still there. My error message was as follows "pandoc.exe: Error producing PDF from TeX