knitr

How to start page numbering in R Markdown from the second page?

心不动则不痛 提交于 2019-12-05 10:12:52
I was wondering if there is a way to start page numbering from the second page and/or print page numbers starting from second page in R Markdown when creating pdf output? This would be useful when adding a title page to the document. Thanks! After receiving useful comments I solved issue by adding \pagenumbering{gobble} just before the title and \pagenumbering{arabic} after the title page as follows: \pagenumbering{gobble} \centerline{\includegraphics[height=2in]{youricon.png}} \large{TITLE} \pagenumbering{arabic} ...... Other chapters of the document Note that this starts numbering from the

Update posts using knit2wp

☆樱花仙子☆ 提交于 2019-12-05 09:43:23
I have been able to successfully post to WordPress using knit2wp, even with images. Even possessing such talent, I am not infallible. Indeed, even the above took some work. I'd like to be able to update posts later. Apparently, the RWordPress package allows for deletion of posts, but that doesn't help much if one cannot read the metadata of a post, delete it, post a new post, and update the metadata … and I do not offhand see an option or function to just update a post. Any and all suggestions welcome. Thank you. As you've alluded to, the RWordPress package in R does not support editing of

Unable to get tikzDevice to work

本小妞迷上赌 提交于 2019-12-05 07:56:45
I have a problem with tikzDevice . I'm using the latest versions of R (with latest knitr and tikzDevice packages) and RStudio , updated TeX Live to 2015 binaries (and I think I have all the required packages). When I try to output graphics to tikzDevice , compilation hangs. Other graphics devices like PDF or CairoPNG work without a problem. As an example, I tried to compile a the simple code below from RStudio with XeLaTeX (set as the default LaTeX compiler in RStudio ), but it hangs forever after using the TikZ metrics dictionary. What I see is that the compilation actually produces a file

RMarkdown / pandoc fails to knit Pdf with latex color commands

对着背影说爱祢 提交于 2019-12-05 07:21:21
问题 Mac Os: 10.11.6 R version: 3.3.1 MacTex: 2016 / TexLive: 6.2.2 RMarkdown: 1.0.9014 Knitr: 1.14 Pandoc: 1.17 RMarkdown fails to knit PDF when latex commands such as: \textcolor{blue}{Character String} are present in the .rmd file. The error output is: /usr/local/bin/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template ~/R/3.3/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style

HTML outputs are different between using knitr in Rstudio & knit2html in command line

半腔热情 提交于 2019-12-05 07:10:53
I am trying to generate html documents from R markdown files using knitr. When I use the knit html button in R studio it works fine and it gets me the desired output. However when I use knit2html() in the commandline, the formatting of the output html is different (less prettier) than that obtained from rstudio. Can you tell me what are the exact options and functions that are being used when I press the knit html button? I wanted to include images, but apparently my "reputation" is too low... Basically, the major difference are : 1) code chunks and outputs have smoother edges 2) header is

Limit Output of Function in Rstudio (3.1.1) when Knitting to PDF

心不动则不痛 提交于 2019-12-05 06:13:41
I would like to limit the number of lines that are produced from a function when I knit my markdown document in R. I've looked around quite a lot but can't find a solution. My code is below, it gives 50+ lines of data when run. My goal is to only have 9 lines of code produced by the sedist function. ```{r, results=1:9} sedist(FILENAME, method="correlation") ``` I have tried using {r, message=1:9} , {r, Hide=1:9} , {r, height=1:9} , {r, results='hide'} and similar. Something like this?? ```{r R.options=list(max.print=10)} df <- data.frame(x=1:100,y=1:100) df ``` The R.options chunk option in

How can I set graphical parameters (par()) and structure options (strOptions()) in a knitr document?

久未见 提交于 2019-12-05 06:01:13
I am working on a knitr-sweave document and have found that global R options like par(lwd=3) and strOptions(strict.width='cut') do not take effect in later code chunks. I can specify these options as arguments each time I plot() or str(), so it's not a huge problem. I'm just wondering if anyone has any insight into this. Should I be caching the code chunk where I set these options? I call some libraries in early code chunks and set variables in others and they all seem to be accessible "globally" (i.e. in later code chunks). I believe I can help you with setting strOptions globally. Just set

References page truncated in RMarkdown ioslides presentation

落花浮王杯 提交于 2019-12-05 05:39:57
I prepare a ioslides presentation in RMarkdown via RStudio. As the presentation contains a lot of references they are truncated: With {.allowframebraks} there seems to be a quick solution for beamer presentations as this answer shows. Is there one for ioslides, too? This isn't exactly what you're asking for, but it might be the best you can do. Insert the following inline CSS at the end of your document (i.e. just before where the references will be inserted), and instead of truncating them, it will add a scroll bar (the first part) and suppress the page number (the second part). <style>

Longtable in a knitr (PDF) document: using xtable (or kable)

时光总嘲笑我的痴心妄想 提交于 2019-12-05 05:17:39
I am new to knitr and I have had some very basic latex knowledge in the past, so I googled already hoping to find a solution that was already posted somewhere. However, I was not able to solve my problem. I am hoping someone will be kind enough to provide help. I have a data frame of 14 columns and many rows, let's say 60. Using the data I need to produce a PDF report in landscape layout and present this data frame as a table there. The closest solution I found is here at tex.stackexchange.com: LaTex Longtable spanning several pages I used some of the hints there. However, the table is not

Using R-markdown knitr hooks to custom format tables in HTML reports

本秂侑毒 提交于 2019-12-05 05:17:20
I am trying to set up a knitr::knit_hooks() to automatically format data frame output of an R-markdown chunk with kableExtra in my HTML report. I would like to not repeatedly add the following lines (or any lines) to the end of each chunk of tabulated data: head(iris) %>% kable("html") %>% kable_styling("hover", full_width = FALSE) I came up with one solution based on this answer that works by evaluating the chunk source (see my answer below that includes some issues that I have with this approach); I'm hoping there might be a better solution using the chunk output . Here is an example .Rmd