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.
3
votes
3answers
116 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 ...
1
vote
0answers
62 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!!
...
1
vote
1answer
77 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
96 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 ...
0
votes
0answers
64 views
Using Notepad++ with MiKTeX and R (sweave) on Windows
This link provides a great tutorial on Using Notepad++ with MiKTeX on Windows I wish to extend this to run a combinationR and LaTeX using Notepad++ (sweave). I ran run R from Notepad++. I can run ...
0
votes
0answers
54 views
does not produce output table in pdf using Sweave and xtable
If I try to get 3 tables I only get the first two. I'm running out of ideas here:
<<test.2m,echo=false,results=tex>>=
library(xtable)
a = ...
3
votes
1answer
199 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
47 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 ...
6
votes
2answers
170 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 / ...
0
votes
0answers
41 views
Blackened window instead of plot generated with Sweave [closed]
I'm trying to generate two plots side by side using Sweave and the subcaption package.
The thing is, that in the created pdf I get only blackened windows instead of plots (in the separate pdf files ...
2
votes
1answer
63 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
58 views
Long and rescaled xtable
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
2
votes
2answers
127 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 ...
5
votes
2answers
172 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?
...
5
votes
1answer
161 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
219 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
153 views
knitr : Figure are not appearing at the correct place
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
62 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
79 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
64 views
Highlight R chunks in a Knitr document when working in Kile
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
130 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
87 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
234 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
259 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 ...
0
votes
0answers
84 views
Converting R input into tex [closed]
During my work with R on Markov chains, I have to handle big matrices, which I want to transfer into LaTeX documents. Is there an easy method to do that without changing every single "," in my R-code ...
3
votes
1answer
178 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
1answer
114 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
160 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
358 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
67 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
196 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
182 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
136 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
263 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 ...
3
votes
1answer
300 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
159 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 ...
3
votes
2answers
468 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" ...
4
votes
2answers
373 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 ...
6
votes
3answers
553 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
73 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
...
0
votes
1answer
436 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
157 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 ...
3
votes
1answer
198 views
number separator formatting with ragged right positioning using siunitx, R, Hmisc::latex
I found Boris's suggestion to use siunitx to achieve number formatting in Hmisc::latex tables to almost be exactly what I was looking for:
R, Sweave, Hmisc: pretty-print numbers
However, if you look ...
1
vote
0answers
178 views
R: Prettify xtable() output for printing a matrix or dataframe [closed]
Following a suggestion, this is a repost from stackoverflow. I am trying to print out this table from R using xtable(). The default output is ugly. Is it possible to embed latex code within xtable() ...
3
votes
1answer
259 views
R listings operator partially in bold
I am using listings to display R code. The matrix multiplication operator shows up partially bold, something like this: "\%\textbf{*\%}". If I separate the * and the %, the second % is not in bold.
I ...
2
votes
0answers
91 views
Sweave Float environment over 2 pages
I have a bit of Sweave code as such:
<<label = Example1, echo= true>>=
//Bunch of R Code
@
I've tried putting it in my own float environment like so
\newfloat{rcode}{h!}{rcode}
...
4
votes
2answers
196 views
How to label a code section in Sweave
I'm new to sweave and was wondering what is the appropriate way to label a code section. For example, if I have:
<<echo= true>>=
x<-5
y<-x+5
@
How would I get it to put a either ...
3
votes
1answer
450 views
Latex listings R: need mono-spaced font with bold keywords and correct caret (^)
I am using the listings package to display R code. I would like a monospaced font, bold keywords, and I would like code that works when the user cuts and pastes from the pdf file into rstudio. The ...
8
votes
1answer
905 views
R+LaTex to HTML5 better than pdf?
I use R together with ggmap, ggplot2, Rstudio, knitr, and beamer to produce presentations in pdf. Soon I hope to have time to learn TikZ too. I have not moved to Markdown because I appreciate the ...
3
votes
1answer
749 views
How to print a LaTeX matrix using xtable in R
I'm trying to get R to print a matrix as a LaTeX matrix using xtable, using the LaTeX environment bmatrix.
a <- matrix(rnorm(25), 5 ,5)
x <- xtable(x)
> print(x, floating=FALSE, ...