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

1
vote
0answers
125 views

Use Xtable to do plus minus

I am using a similar dataset to the following: a= c("Fruits", "Adam","errorA", "steve", "errorS", "apples", 17.1,2.22, 3.2,1.1, "oranges", 3.1,2.55, 18.1,3.2 ) ...
8
votes
1answer
1k views

How to build Knitr document from the command line

I would like to compile a knitr document from the command line. With Sweave, the sequence R CMD Sweave my_sweave_file.Rnw latex my_sweave_file.tex latex my_sweave_file.tex dvips my_sweave_file.dvi ...
4
votes
1answer
175 views

Sort database with datatool

I use the datatool package to read CSV files and print them as tables. Before printing I want to sort the rows. The problem is that the file was written with R and some rows contain normal numbers ...
2
votes
1answer
377 views

How to add horizontal lines within a table created by Hmisc::latex()?

lets suppose we have a table given in R and use the function latex() from the R package Hmisc to include the table in a Sweave (or knitr) document. My question is: Is there a way to add horizontal ...
10
votes
2answers
1k views

Building TeX file from knitr Rnw as child of larger parent TeX file to use R objects and output

Here's my general 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 multiple chapters as ...
2
votes
1answer
136 views

How can one make RStudio pass options to Sweave()?

I'm trying to use a UTF-8 encoded .Rnw file in combination with xelatex in RStudio. Since xelatex uses native UTF-8 support i cannot use \usepackage[utf8]{inputenc} in my .Rnw file, which would ...
1
vote
0answers
137 views

Knitr/LaTeX: conditional execution based on external parameters

I'm using knitr to create LaTeX documents with integrated R code. Now I'd like to readout some external parameters (saved in a TXT or CSV file) and create a document based on the conditions specified ...
8
votes
1answer
962 views

Barchart with pgfplots with data from R

It took me a while to create a nice (... to some extent) bar chart with R which represents what I need. However I noticed it doesn't look very aesthetic in my Latex document. Sweave isn't a good ...
3
votes
1answer
298 views

How can I center a Sweave verbatim chunk?

I have a very simple sweave chunk with two lines, like this: <<results=verbatim>>== quantile(foo$bar) @ How can I center this element? I've tried embracing the chunk with \begin{center} ...
1
vote
0answers
2k views

Fatal error occurred, no output PDF file produced in php file [closed]

We are using following code in .php script for generate .pdf file. $result1 = exec("R CMD Sweave /var/www/html/r/r_latex_sweave.Rnw"); $result2 = exec("pdflatex /var/www/html/r/r_latex_sweave.tex"); ...
0
votes
0answers
2k views

Fatal error occurred, no output PDF file produced [duplicate]

we are executing following code from .php file. $result1 = shell_exec("R CMD Sweave /var/www/html/r/r_latex_sweave.Rnw"); $result2 = shell_exec("pdflatex /var/www/html/r/r_latex_sweave.tex"); But, ...
4
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
122 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
380 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
670 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
64 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
206 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
274 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
564 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
317 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
179 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
469 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
6k 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
228 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!! ...
4
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
502 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
993 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
84 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
875 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
182 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 ...
3
votes
0answers
106 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
446 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
357 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 ...
0
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
181 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
101 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
202 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
143 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
253 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
343 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
342 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
543 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
423 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
388 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
237 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 ...
4
votes
2answers
921 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
173 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
333 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 ...