knitr is an R package for dynamic report generation based on the concept of literate programming.

learn more… | top users | synonyms

2
votes
1answer
26 views

How can I conditionally reference a figure?

So here's my knitr .Rnw file: \documentclass{article} \usepackage{hyperref} \hypersetup{} \begin{document} \let\ref\autoref <<plot,fig.cap='try'>>= if(rnorm(1) > 0) x = rbinom(1, 100, ...
0
votes
1answer
39 views

what does this error message suggest?

An error just prompted up when I process an .Rnw file using RSudio: Loading required package: knitr Warning message: package ‘knitr’ was built under R version 3.1.2 processing file: ...
1
vote
1answer
21 views

knitr: less/greater than sign displayed as (¡) and (¿)

I'm a beginner in using knitr to generate a report. I have a R script (see below for an example; BTW I'm using RStudio for all of this) that runs without error and the output is a data frame. My ...
1
vote
2answers
40 views

Conditionally print text with inline R data via knitr

I want to conditionally print a sentence that contains a \Sexpr{} in knitr. How can this be done? I know I can conditionally print text using \Sexpr{} but I run into issues when the text to be printed ...
0
votes
0answers
9 views

Fill arbitrary number of “template analysis page” based on data output by R

I'm using knitr to produce a report on anomalies detected in a machine. I've got an R script that searches for anomalies (there can be an arbitrary number of anomalies) and the script also produces a ...
2
votes
2answers
53 views

Install knitr on own shareLatex server

EDIT: According to a ShareLatex Github discussion, I should create a .latexmkrc file and add the following code (I tried already in the home directory but it didn't work) : my $root_file = ...
2
votes
1answer
38 views

knitr render html code

How to render html output to pdf in knitr? Here is my code \documentclass{article} \begin{document} <<echo=TRUE, results= 'asis'>>= library(xtable) n <- data.frame(x = 1:6, y = 15:20) ...
1
vote
0answers
33 views

How can I remove extra spaces in code passed through probsoln package?

This is an easy question to a potentially complicated situation. I'm using RStudio to write homework and exams using the probsoln package that embeds R code into the LaTeX directly. I am using knitr ...
3
votes
1answer
40 views

Input Tex file in knitr file

I am showing a simple example here just to frame the question. \documentclass{article} \begin{document} <<>>= library('ggplot2') dataset <- diamonds @ \begin{table}[htbp] ...
2
votes
1answer
74 views

How to use Umlauts (äüö) in axis label with knitr, LuaTex and tikz?

When compiling pdf documents with complex tikz figures using knitr, the pdftex engine would sometimes run out of memory. Thus, I used the luatex engine to compile these Rnw files. However, I am not ...
2
votes
2answers
39 views

shrink knitr output to multiple columns

I am providing a very simple example here. In my dataset, I have 50+ names in column. I get annoyed by the fact that colnames() output takes 50+ lines too! Is it possible to divide the output over ...
1
vote
1answer
39 views

chunk on a new page in knitr

I have a situation where i am knitting a bunch of figures in \enumerate and figures are big such that I would prefer one page for every figure. \documentclass{article} \begin{document} ...
0
votes
1answer
57 views

Modify R output in LaTeX

I'm currently writing a paper for my bachelor thesis with LaTeX. I'm pretty new to LaTeX and I was wondering whether I can modify the R output in LaTeX. For Example: If I type in this: ...
1
vote
1answer
111 views

Creating Bold Column Headers using xtable (knitr)

what is the easiest way to bold all column headers using the output of calling xtable, ideally under the print.xtable command. I am using knitr.
2
votes
2answers
73 views

bundledoc fails with subfolder paths (MiKTeX)

I would like to use bundledoc mainly in Windows with MiKTeX. However, I encounter a problem with subfolder paths that is annoying. I run the program as follows: bundledoc --config=miktex.cfg ...
1
vote
1answer
74 views

Capturing final figure caption using knitr

I'm writing a paper for the journal PLOSone. They require that figure captions be placed in the article but not the figure itself (it's submitted separately). So I'm wondering how to get knitr to ...
2
votes
0answers
88 views

R-code linebreaks AND themes in knitr

hpesoj626 provides two great minimal working examples for how to get R-code linebreaks AND code highlighting in knitr. I was wondering if it was possible to use Yihui's knitr themes within either of ...
1
vote
0answers
64 views

Table dull when transferred from R to word [closed]

I am using latex in R (mostly copied codes) to make beautiful tables. But transferring tables with the help of snipping tool used or saved as jpg from R to word, the table looks dull and not rich ...
0
votes
0answers
44 views

R data.table and knitr

I have an automated report that i produce using knitr. i'm running across the oddest problem. I wrote a function that sums the data by month for several locations. when i run this function in R i ...
0
votes
0answers
34 views

Unwanted white space with knitr+booktabs package

I want to include a table in my latex document that I create using knitr package. I "call" the table using: \begin{table}[H] \begin{centering} <<r second part}>>= kable(Per_cond, ...
2
votes
0answers
36 views

After updating to LyX 2.13: getting this message Sweave Noweb syntax? [closed]

After updating to LyX 2.1.3, I'm getting this message Sweave Noweb syntax?. I wonder what message mean and why I'm getting it? After clicking on ok, it works but I'm looking to not show this ...
1
vote
1answer
52 views

Why does this fail in LyX 2.1.3 but works in .Rnw?

This code works fine in .Rnw but does not work in LyX 2.1.3. In LyX 2.1.3 it throws the following error: Error in getModel.baseGmm(all_args, ...): could not find function "is" Any idea how to ...
1
vote
2answers
240 views

knitr in RStudio produces 'Undefined control sequence', alongside other issues

I am getting multiple issues being reported when I try to 'Compile PDF' for a knitr document in RStudio (Windows 7), although the .pdf is still produced in the working directory. I am using R 3.1.3, I ...
5
votes
0answers
89 views

What are the advantages of switching to Emacs for TeX/knitR work?

Currently, I am using TeXStudio. Now, I am considering to switch to Emacs because I heard that is has its advantages when it comes to R and knitR. But what are the specific advantages? Yet, I am still ...
0
votes
0answers
162 views

utf8 encoding problems with knitr

I'm using RStudio 0.98.1102 on Windows 7 with knitr 1.10 (R 3.1.2) and tried to knit the following file: \documentclass{article} \usepackage[ngerman]{babel} \usepackage[utf8]{inputenc} ...
0
votes
1answer
51 views

knitr-manual.lyx fails to compile on LyX 2.1.2

My error message gives me the following: An error occurred while running: Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.1/Resources/scripts/lyxknitr.R" ...
0
votes
0answers
132 views

Best way to Insert R code into a LyX document

Let's suppose that I have a set of R (3.1.2) scripts that I would like to display in LyX (2.1.2). I could use Program Listings, but I think this looks very unprofessional. I am wondering if anyone can ...
2
votes
1answer
62 views

Insert knitr (1.9) Chunks From Separate File Into Lyx (2.12) Document

I have a LyX document (report class) called mwe.lyx and I would like to execute the following Rmd chunk called "mwe.Rmd". {r, eval = FALSE, echo = TRUE, cache = FALSE} 2+2 Of course, I can ...
2
votes
1answer
94 views

How to modify knitr output chunk

I know that it's possible to tweak the output of a knitr code chunk so that it looks the way you want. My problem occurs when using the parskip package. The parskip package adds an extra bit of space ...
1
vote
0answers
52 views

Blog publishing / creation from Latex

I have been using Latex for a few years, and have several articles written in Latex. I want to share some of these articles on blogs, and I am very new to the blogging world. Just wondering if there ...
1
vote
0answers
48 views

Using xtable with listings package

I am the listings package as suggested by the following solution provided in this question: Getting Sweave code chunks to stay inside page margins? More specifically, I am using the following piece ...
2
votes
3answers
131 views

What's the best .Rnw editor?

I'm trying to find out what people use for editing .Rnw files. Desirable features are: Auto R code completion Auto LaTeX code completion Cross platform Automatic display of R function documentation ...
1
vote
0answers
159 views

Problem using tikzDevice in knitr

I can't seem to get knitr to work with tikzdevice. A simple example: \documentclass{article} \begin{document} <<test, dev='tikz'>>= library(knitr) library(tikzDevice) library(ggplot2) ...
2
votes
1answer
257 views

knitr: LaTex Longtable spanning several pages with word continued at bottom and caption appears only once in list of tables

I want to have longtable spanning several pages with word continued at right bottom of the table and its caption appearing only one in the list of tables using knitr. Below is my MWE in .Rnw format. ...
0
votes
0answers
46 views

How to cleanly post-process PDF compilation in AUCTeX and ESS?

This question is somewhat related to this one, but separate. Thanks to Jan Gleixner's utility, One can obtain synchronization between a source foo.Rnw compiled by knitr and the resultant foo.pdf. ...
1
vote
1answer
79 views

Auctex evince synchronization problematic with accented characters in file paths

I recently stumbled on this nice problem (bug ?) : I can use evince to visualize foo.pdf output from LaTeX obtained in AUCTeX and Synctex synchronization,as long as none of the files referenced in ...
4
votes
1answer
109 views

Pass a class/package/theme option to R with knitr

I have a beamer document with R chunks, say 'template.Rnw', which I compile with knitr using 'compile PDF' in RStudio. I have defined a theme 'mytheme.sty'. I would like to have an option to the theme ...
0
votes
1answer
143 views

Which software should I use for making high quality graphs? [closed]

I have written a paper in MS-Word. Now, I am converting it into LaTeX. The problem that I am facing is about figures. Some of the figures I have converted using Adobe Illustrator. However, since I ...
1
vote
0answers
72 views

How can I show a caption, subcaption and source similar to this NY Times style?

I would like to create a LaTeX document that mimics the style used on the NY Times' Upshot Blog (example at NY Times). Here is the desired output: They have these features: A thin gray line ...
2
votes
1answer
150 views

insert figure in sweave using knitr fig.path Version 2

I have a question similar to this post. I am trying to add a .jpg to a .Rnw file (compiling LaTex with RSweave and knitr). I've tried the following without success: ...
1
vote
1answer
171 views

How to include a .TeX file generated from .Rnw file into a .TeX file which is child of parent .TeX file?

I really need help. Here is the problem: I'm writing my dissertation using a LaTeX template (http://www.latextemplates.com/template/masters-doctoral-thesis). The template is a parent file with ...
2
votes
1answer
143 views

knit() doesn't create .tex file with necessary preamble

I have a question about creating .tex from .Rnw using knitr in Rstudio. I have a test.Rnw file while looks like the following: \input{report_preamble_en.tex} \title{test} \author{author} ...
4
votes
0answers
146 views

tikz stops drawing into pdf after 20 line segments in plot generated through knitr tikzDevice

Problem If I try to draw a curve generated through knitr using tikzDevice into .pdf only 20 line segments of that curve are drawn and TeXstudio, through which I do it, just leaves message running ...
2
votes
1answer
153 views

SumatraPDF inverse search for RNW files

I'm using TexStudio to edit my rnw files. I setup an inverse search from SumatraPDF to TexStudio using THIS (verbatim) which is a renewed version of THIS. When I double click a text in SumatraPDF it ...
1
vote
1answer
150 views

How can I nest a code chunk within an enumerate environment when using R Markdown?

When I attempt to do this using this code: --- title: "Title" author: "Me" date: "31 October 2014" output: pdf_document: includes: in_header: includes.sty --- ...
2
votes
1answer
224 views

Special characters and math-mode in tikz graphics using knitr

This question closely relates to this one: Using '$' in a tikz plot generated by knitr I am able to get tikz graphics using knitr working with math mode as in this post: Math mode in knitr ...
1
vote
0answers
102 views

Force Knitr Figure on same page

I am using Knitr on RStudio. <<glmall, include=TRUE, fig.align='center', fig.cap='Diagnostics plots for full-model with GLM (Poission)', fig.show='asis'>>= par(mfrow=c(2,2)) ...
1
vote
1answer
77 views

Using geom_segment dashed line has odd behavior when using tikz device

My example is: \documentclass[12pt]{article} \begin{document} <<eg, dev='tikz', size='normalsize', echo=FALSE, message=FALSE, warning=FALSE, sanitize=TRUE>>= require(ggplot2) p1 <- ...
0
votes
1answer
78 views

Using '$' in a tikz plot generated by knitr

My example is: \documentclass[12pt]{article} \begin{document} <<eg, dev='tikz', size='normalsize', echo=FALSE, message=FALSE, warning=FALSE>>= require(ggplot2) ggplot(cars) + ...
6
votes
1answer
3k views

no tex installation detected on RStudio after OS X 10.10 yosemite upgrade

I upgraded my MAC to OS X 10.10 yosemite today. Now, when I run RStudio and try to use Knitr to compile pdf, it says no text installation detected. So, I did the following steps sequentially. ...