knitr

How to only show table caption once in “list of table” for a table split onto multiple pages

我与影子孤独终老i 提交于 2019-12-06 12:56:49
问题 I am using R packages ( xtable and knitr ) and Latex packages ( longtable and hyperref ) to prepare a document. One of my tables is very long and splits onto multiple pages. It turned out that the "List of Table" shows every page number at which this table appears, but all hyperlinks bring me to the beginning of this table. My question is, in "List of Table" how can I just show the first page number at which this table appears. \documentclass{article} \usepackage{longtable} \usepackage

How to solve R Markdown (Knit) “'closure' is not subsettable”?

﹥>﹥吖頭↗ 提交于 2019-12-06 12:31:48
I am trying to use RMarkdown (Knit) for the first time to produce pdf. The default file (File > New File > R Markdown) works well, it shows the generated pdf when compiled. For example, the following code runs, ```{r cars} summary(cars) ``` However, if I just change cars with "myData," it does not compile and shows, Error in object[[i]] : object of type 'closure' is not subsettable Calls: <Anonymous> ... withVisible -> eval -> eval -> summary -> summary.default Execution halted I have "myData" loaded in the global-environment and can do other operations in original R script. Can someone please

How to add a watermark image on rmarkdown?

淺唱寂寞╮ 提交于 2019-12-06 12:07:45
I'm searching and trying to add a image as watermark to rmarkdown pdf, I'm using the render function to generate the PDFs, and saw the \usepackage{draftwatermark} and this question: Watermark in rmarkdown But they don't help me in adding a image as watermark. --EDIT-- I achieved what I wanted putting this to the header of .Rmd: header-includes: - \usepackage{eso-pic,graphicx,transparent} And placing this in the start of file (before the rest of .Rmd): \AddToShipoutPictureFG{ \put(0,0){% \parbox[b][\paperheight]{\paperwidth}{% \centering {\transparent{0.3} \includegraphics[width=\paperwidth

Adding space around figures in RMarkdown

扶醉桌前 提交于 2019-12-06 11:47:50
问题 I would like to add space around figures in RMarkdown. I am knitting to PDF and really don't like how close figures (or also equations) are to the text or to the next figure. --- output: pdf_document --- ```{r pressure, echo=FALSE} plot(pressure) ``` ```{r pressure2, echo=FALSE} plot(pressure) ``` There is just too little space between the two plots and this gets more fuzzy when using ggplots. Right now I use the Latex solution \vspace{10pt} but it would be nice if I could make a setting

knitr to produce pdf output file

拈花ヽ惹草 提交于 2019-12-06 11:40:38
I would like to be able to use knitr to produce a structured PDF file. I did not see anything unless the input file is Sweave format. This question may be too vague but I really like to know right from knitr , is it possible to create a structured PDF output file without using any Sweave or LaTeX ? RUser Try using command knit2pdf if you haven't already. 来源: https://stackoverflow.com/questions/14586177/knitr-to-produce-pdf-output-file

knitr::include_graphics in bookdown, is not rendering the image

自作多情 提交于 2019-12-06 11:30:18
I am trying to include a .png file in a file that I am rendering using bookdown. knitr::include_graphics() should be the way to go. The code: ```{r fig1, fig.cap='My Caption', echo=FALSE, message=FALSE, warning=FALSE} knitr::include_graphics("./Figures/My Figure.png") ``` In the .Rmd file, I can run my r block, and it renders the image below. So, the path should be correct. However, when I knit the chapter, or render the entire book, the figure is not rendered. Could it be that some of my other options are overriding the figure? Below are my YAML header of the index.Rmd file, and the code in

unable to run knitr to produce a pdf output file

旧城冷巷雨未停 提交于 2019-12-06 11:14:01
I have sweave file like this: test.rnw \documentclass[letter,10pt]{article} \usepackage{amsmath} \usepackage{amscd} \usepackage{ifthen} \usepackage[utf8]{inputenc} \usepackage{hyperref} \usepackage[top=1.0in, bottom=1.0in, left=0.75in, right=0.75in]{geometry} \begin{document} \title{Top areas of focus for \\ This is a test} \author{ test } \maketitle \pagebreak \tableofcontents \pagebreak \section{Introduction} this is a test document \end{document} I am trying to manually run knitr agaist it and produce a pdf file like this: knit2pdf("test.rnw", "test.pdf", compiler="texi2pdf") I am getting

servr::jekyll() yields ready website, servr:rmdv2() does not

落花浮王杯 提交于 2019-12-06 11:10:45
I'm basing my rmarkdown -Jekyll-Blog off of Yihui's fantastic boilerplate for using servr::jekyll() , which in turn wraps knitr . Because I want to use citations (via pandoc-citeproc , wrapped by rmarkdown ) I need to use rmarkdown::render , not knitr to, well, render the *.md s. As per the servr manual, I understand that rmdv2() should do the job, which essentially wraps/modifies jekyll() : The functions rmdv1() and rmdv2() are similar to jekyll(), and the only difference is the way to compile R Markdown documents: rmdv1() uses the markdown package (a.k.a R Markdown v1) via knit2html(), and

Creating R tables with embedded graphics

别等时光非礼了梦想. 提交于 2019-12-06 11:05:50
问题 I'd like to be able to create a table with one of the columns being graphical, others text. Ideally, I'd create an excel spreadsheet, but I'm pretty sure that none of the R to Excel packages can write PDFs into cells. I think I can hack something together using Knittr or Sweave, though I don't know how, exactly. Any advice? 回答1: I've tried to reproduce your example : So I've looked into the R dataset, and used a baseball dataset, though I have the nagging doubt that for baseball players, the

knitr strange out of control behavior with figures

喜欢而已 提交于 2019-12-06 10:29:26
问题 I get strange behavior with figures. In some chunks knitr generates two figures from a single plot function, and the figures generated from 'chunkname' are named 'chunkname1.pdf' and 'chunkname2.pdf'. Sometimes, the first one is just a blank figure of the same size as the second one, and sometimes it is a file which cannot be open. As a work around, I set the fig.keep='last' option. But now I would like to display two plots from a same chunk and setting fig.keep to its default value, knitr