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.
1
vote
1answer
41 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
37 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 ...
0
votes
0answers
83 views
Opening .Rd file [closed]
I am really new to all this LaTeX documentation. I've been trying to open an .Rd file for the better part of the morning without success.
I have tried these two methods to get a readable file:
Rd ...
1
vote
1answer
34 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 ...
6
votes
1answer
176 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 ...
0
votes
1answer
56 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
29 views
Citations not working in Sweave
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
32 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
188 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
81 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
119 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
145 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
100 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
88 views
does not produce output table in pdf using Sweave and xtable [closed]
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
269 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
50 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
204 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
42 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
72 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
73 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
3
votes
2answers
160 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
210 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
190 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
326 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
174 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
65 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
90 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
76 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
136 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
97 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
242 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
280 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
93 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
195 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
139 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
167 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
382 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
73 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
212 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
203 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
142 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
279 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
330 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
167 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
488 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
433 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
629 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
82 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
475 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
164 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 ...