R is an open source programming language and software environment for statistical computing and graphics. It is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme.

learn more… | top users | synonyms

3
votes
4answers
2k views

Error: Font ts1-zi4r at 540 not found

I use MikTeX in order to compile pdf files when creating R packages. Today I found out that I run into the following error: * checking PDF version of manual ... WARNING LaTeX errors when creating PDF ...
6
votes
1answer
109 views

Allow [ characters in tables without entering math-mode (from R)

I have R code that produces latex code like: \begin{tabular}{D{.}{.}{7}D{.}{.}{7}} \toprule \multicolumn{1}{c}{x} & \multicolumn{1}{c}{y} \\ \midrule [1, 5) & 1 \\ [1, 5) & 2 \\ [5, 8) ...
5
votes
3answers
346 views

import R data frame into org-mode table

I have an R script that generates a data frame, that I export to a CSV file. The data looks something like this: "","Variant","Xaxis","N","mean","sd","se" "1","line1",10,5,111.11,9.33,3.11 ...
3
votes
1answer
530 views

How can I insert Sweave code inside a Beamer block?

I'm currently trying to automate a report-generating routine in R, and I imagine the best way to try this is through Sweave and beamerposter. The report should have one page with several sections in ...
1
vote
0answers
63 views

Links of book templates [duplicate]

This report is written by using R and Latex. I am kind of curious to see the Latex and R codes behind the generation of this excellent report. Can anyone suggest me some links directing to excellent ...
5
votes
1answer
178 views

Best practice regarding graphics size

Whenever I make graphs from R to be included in Latex, I find myself scuttling back and forth between R to specify the size of the output and Latex to play with the \includegraphics[scale=??]. It ...
3
votes
1answer
232 views

Sweave outputs gibberish

I have this .Rnw file: \documentclass{article} \begin{document} <<>>= data(cars) fit <- lm(cars$speed~cars$dist) summary(fit) @ \end{document} I am using RStudio to build the PDF ...
2
votes
1answer
437 views

insert figure in sweave using knitr fig.path

I'm trying to insert a figure using Sweave which is located in the path C:\Users\eccehomo\Documents\mi\fig1.png. I'm using the package knitrwhich has a function called fig.pathbut I'm getting many ...
8
votes
1answer
308 views

proper tool for charts in tex

I have scanned data graphics in a large ms written in TeX (of course). For copyright reasons I need to redraw these. My publisher may (sadly) decide not to use my source directly, so will need access ...
1
vote
1answer
175 views

How to print a system of linear equations in matrix form using sweave?

I would like to print a system of linear equations, a right bracket, a right arrow and finally the output of the system (x). Something like Ax = b } ---> x. It is hard for me to find the right way of ...
1
vote
0answers
44 views

Citations not working in Sweave [duplicate]

I am trying to run this Sweave code in R. \documentclass{article} \begin{document} \SweaveOpts{concordance=TRUE} \section{Section} I am citing \cite{ftest}. \begin{thebibliography}{9} ...
2
votes
1answer
337 views

\Sexpr shows only one value from a vector with two elements in sweave

I can't get the two elements of the vector using: <<>>= z=c(1,2) @ \Sexpr{z} I have googled a lot but don't understand why I get just the first element.
3
votes
3answers
5k views

How to include R output in LaTex? [duplicate]

I am not sure about how to include my r output in the best way in my latex document. Currently I saved my R output (NOT R CODE!) into a txt file: *---------------------------------* * GARCH ...
2
votes
1answer
220 views

Doodle on top of Sweave output

It might not be possible to do this, but I was wondering if there is a way to doodle on top of the LaTeX output, or in my case on top of Sweave output. See example underneath!! ...
2
votes
1answer
3k views

Trying to include R Code with listings package

I was trying to include some R Code in a simple LaTeX document, but for some reason I could not do it. I put the R Code in the same directory (I also tried putting the full directory for my R Code) of ...
4
votes
1answer
410 views

Using Greek letters in LaTeX tables

I have the following Rnw document which I intend should produce a small table with "a b c" and "α β γ". At the moment, the encoding seems to be causing problems. The funny thing is that the output in ...
4
votes
1answer
892 views

knitr problem after update to R 3.0.0

I just updated R to 3.0.0. I couldn't compile PDF from my .Rnw file, which I could do with R 2.15. Here is the error I got: ! Undefined control sequence. l.192 \SweaveOpts ...
2
votes
1answer
73 views

Controlling the size of tables produced from the R functions tabular() and latex()

I'll state up front that I'm not absolutely certain whether this question is more appropriate for CrossValidated or for this site. However, since I've seen several questions about the latex() command ...
8
votes
2answers
814 views

tikzDevice is not getting sizes right (knitr)

I am using OSX, pdflatex, R (cran), tikz/tikzDevice and knitr to create my documents. My problem is that the font sizes of the produced tikZ-file do not match the LaTeX document font sizes. Result / ...
2
votes
1answer
165 views

PDFLaTeX produces black boxes after executing Sweave

There is the following code \documentclass[a4paper]{article} \begin{document} hey there <<>>= 1+1 @ \end{document} I saved the example.Rnw in my home directory an ...
2
votes
0answers
103 views

Long and rescaled xtable [duplicate]

Is there a way to use scalebox along with tabular.environment='longtable' when printing a long and wide xtable? When I give both of them I get an error: Running xelatex.exe on my_file.tex...failed
3
votes
2answers
414 views

Modifying the latex code from tabular() in r so that output is not cut off and is displayed properly?

I am using the r function tabular() to produce tables that I can turn into pdfs. The output looks fine, except for some of the tables I am producing. When I compile the pdfs, the table is cutoff on ...
6
votes
2answers
2k views

R-code linebreaks AND code highlighting in knitr

I used the great answer from @Sharpie on 19 Jan 2012 Getting Sweave code chunks to stay inside page margins? to get linebreaks in the R-code, but how can there be code highlighting (colors) too? ...
6
votes
1answer
353 views

Package to create TikZ Figures from R

I am wondering if there is a recommended package in order to create TikZ figures in R. In the paste I have used Matlab2TikZ to create TikZ figures in MATLAB - and I was hoping that there would be ...
-1
votes
1answer
1k views

Quality of R plots in LaTeX [closed]

In R, I use par to prepare four boxplots (using boxplot) as a single image, which I save with the png() command. This image is included in a LaTeX document with \includegraphics. I have experimented ...
1
vote
0answers
179 views

knitr : Figure are not appearing at the correct place [duplicate]

I'm trying to use knitr while learning LaTeX but all my figures are placed at a seemingly random place. It's driving me insane. Any ideas? Example Input PDF Output I tried reinstalling TeX Live ...
2
votes
1answer
99 views

How to put R code into a parameter of a newcommand?

I would like to put R code into a parameter of a newcommand in LaTeX. To do it, I make the following: %Define the newcommand: \newcommand\solution[1]{\sf #1} %Then, after the \begin{document}, I ...
3
votes
1answer
185 views

How to control latex appendix environment when placing R code in?

I am having a problem with latex environment. When I place r code using \begin{lstlisting} ... code..\end{lstlisting} other objects like tables are displayed only after the script subsections, despite ...
2
votes
0answers
126 views

Highlight R chunks in a Knitr document when working in Kile [closed]

When working on a knitr document in kile I can get highlights for the LaTeX parts of the document by adding the *.Rnw file extension in the Modes & Filetypes tab under Open/save configuration ...
0
votes
2answers
236 views

How to remove name while including image in LaTeX?

I am including an image in R and found the name of the image file appearing with the image: name<-c("A.pdf","B.pdf","C.pdf","D.pdf") <<echo=FALSE,results=tex>>= for (i in 1:4) ...
1
vote
2answers
302 views

Sweave documents: saving output for later use

I am fairly new to the idea of sweave documents. My document is a .Rnw file containing LaTeX code and R code. Part of my R code is computationally intensive and delays the compilation of my .Rnw ...
8
votes
1answer
324 views

Inconsistent output for R language operators when using listings package

A referee noticed that the <<- (assignment to a global) and %*% (matrix mult.) operators in a code listing I used were wrong. I am using the standard listings package (version 1.4 dated ...
2
votes
2answers
513 views

Fedora manual installation and dependencies

Following answers on this website (like: How to use TeX Live on Fedora 17? and Manually installed TexLive on Fedora 16 ) I installed texlive manually on fedora and it works flawlessly. The problem I ...
3
votes
1answer
400 views

How use LaTeX counters to label knitr code chunks?

Imagine one has the LaTeX environments Example and Solution defined from the theorem environment. I have several Examples in numerous child documents which make up a book. LaTeX will automagically ...
2
votes
3answers
363 views

Bold font problem while using Russian fonts

This refers to my previous question not able to write bold characters using textbf I installed the cm-extra font package but still there is a problem with boldface due to ...
5
votes
1answer
228 views

Plot weighted frequency matrix

I wish to create this plot preferably in pgfplots or tikz. I have actually got a version plotted (with help from SO), but I have used R and exported the plot using tikzDevice. I can't post the ...
3
votes
2answers
826 views

Undesired quotes around values in table (pgfplot)

I am saving tables using write.table in R using the following code: x <- rnorm(100) y <- rnorm(100) z <- rnorm(100) model <- z ~ x + y results <- glm(model) pe <- ...
1
vote
1answer
166 views

Sweave: How to remove horizontal space in Soutput environments?

As the following example shows, there is a horizontal space added in the Soutput environment. This leads to a non-left-aligned output (see the output of rnorm(). I found that this space already exists ...
2
votes
1answer
326 views

Adding a knitr table from R into a \pgfplotstableread statement

I'm trying to get a table from R into a pgfplotstable to edit for printing. the r code is \documentclass{article} \usepackage{pgfplotstable} \begin{document} \pgfplotstableread[format=inline,row ...
5
votes
1answer
531 views

How to randomize content with examdesign package using Sweave

Forgive me in advance if this is a dumb question, or too specific to one package. I've been using examdesign to randomize the order of questions, but I also want to randomly generate the content. I've ...
4
votes
1answer
253 views

Align Numeric Values from knitr command \Sexpr{} by Decimal in Table

How can I align numeric values brought in from the knitr command \Sexpr{} by decimal in a table?
2
votes
1answer
475 views

Program Tikz in Beamer

The attached .Rnw-code produces two similar slides, but with different texts and different arrow positions. I wrote both slides manually, but because I need to produce hundreds of similar slides, I ...
4
votes
1answer
674 views

Making a LaTeX text R logo. How maintain the proportions?

I tried to mimic the R logo in jpg format from R site only with LaTeX in order to make it scalable with the context without external files. This is the result at tiny, normal and huge size, compared ...
3
votes
1answer
342 views

LaTeX “command” /incantation for R

I am using the tufte-handout class in LaTeX and I want to refer to R using the "correct" sans-serif font. I am currently using \newcommand{\R}{ {\bf \sffamily R } } used as ... ... function in ...
4
votes
2answers
762 views

TikZ: Drawing the same data with scatter plots and parallel coordinates

I am new to TikZ and trying to recreate the following image (which was created in R): (Translation: correlation = +1, correlation = -1, two clusters, circle, normal distribution) Each "column" ...
5
votes
2answers
1k views

Forcing roman font in LaTeX

I am using a LaTeX template from my university to typeset my thesis. I am making references to R and I have defined a new command with: \newcommand{\R}{R} in order to get the roman "R". The ...
9
votes
4answers
2k views

knitr and biblatex

I'd like to create a PDF report with knitr with LaTeX-code in RStudio with biblatex for citations. However, the in-text-citations are always undefined and no bibliography is printed. The same ...
0
votes
1answer
138 views

Question mark in knitr code getting quote marks [closed]

I'm trying to use question marks in a code block using knitr, but in the compiled pdf always puts quotes around it, so, for example <<helpCode, eval=FALSE>>= ?rnorm @ comes out as ...
1
vote
1answer
1k views

exporting R ggplot2 plots to LaTex

I usually export ggplot2 plots from R using "Save As" PDF and works fine, then I use \includegraphics from LaTex to include the fig. The problem is that it seems that the amount of data in these ...
1
vote
1answer
265 views

How to obtain Sweave(l) listings with rounded corners?

I downloaded the Sweavel.sty-File from here: http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SweaveTemplate/Sweavel.sty Now, for a modern look, I would like to produce rounded corners in the R code ...