Tagged Questions

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
60 views

To get this WordCloud and R working in OSX's Texpad -1.6.0

I am trying to this Hamilton's code about WordCloud, which uses R, working in OSX. I have latest XCode and latest R 3.1.1 (XCode5 support) installed. Texpad 1.4.7-1.6.0 problem I open TexPad with ...
5
votes
1answer
56 views

Can you specify a word separator for variables in listings?

Depending on the language specified, the listings package may or may not bold keywords inside of variable names. Python is fine \documentclass{article} \usepackage{listings} \begin{document} ...
2
votes
1answer
53 views

row and column specifications in xtable output

Using xtable I am trying to format a table x<- 1:5 y<- 11:15 mytable <- table(x,y) print(xtable(mytable)) Which gives I want to add x and y tag also at the top of the rows and sides
1
vote
1answer
314 views

Knitr and rmarkdown will not add figure captions to the output

I am writing a report on Rmarkdown and knitr using RStudio, and cannot find a way to get figure captions on my document. My code for the chunk where I try to plot is like: ```{r ...
3
votes
2answers
95 views

knitr sanitises the % marker for LaTex comments and they show up in the final document

I am writing a knitr document using xtable to get my tables. Xtable inserts by default a comment saying: "latex table generated in R 3.1.0 by stable 1.7-3 package % Thu Sep 18 14:19:21 2014" This ...
1
vote
0answers
74 views

What do you use for plotting? [closed]

I use Latex now for about two years and have written a couple of larger documentations with it. When it comes to plotting (simple or complex, functions or data) I used gnuplot or R. The later more and ...
1
vote
1answer
29 views

fragile/verbatim R code inside probsoln when using an exterior Rnw file for the data sets

A follow-up on this question about using R code inside the environments used in probsoln package. If you uncomment out the section below and define the problem within the main Rnw file, the R code is ...
1
vote
0answers
69 views

Best practice for ggplot transparency in pdf figures

I lost a couple of hours because of few transparent figures which Adobe Professional couldn't flatten to print (it crashed in the process). I wonder if there's any trick to produce PDF figures with ...
1
vote
1answer
33 views

Justifying the output of toLatex function of utils R package

Using utils::toLatex(sessionInfo()) in .Rnw we can get R Session Info to put in LaTeX. I would highly appreciate if someone guide me to fully justify the output of utils::toLatex(sessionInfo()). ...
0
votes
1answer
75 views

How can I include the R source code in the appendix?

I really have no idea how to include the R code into latex, so I only can provide my R code. I would like to put it in the appendix. I am really looking forward to your help. Thx! The codes will show ...
2
votes
2answers
100 views

Getting `tables` R package to print a text file that I can import into my .tex file

I'm trying to write some R code that takes data from my (evolving) experiment, makes a summary statistics table, and inputs it into the .tex document that I'm writing. I want to avoid copy-pasting. ...
0
votes
1answer
84 views

Sweave and R 3.1.0: no pdfs generated

After upgrading R to version 3.1.0 (from some version 2.x.x), the following sweave code does not produce any pdfs for the plots anymore: \documentclass[a4paper,10pt]{article} \SweaveOpts{echo=FALSE} ...
0
votes
0answers
53 views

Convert .R into Latex

I'm really new at this and I couldn't found any realted subject. So I've created my .R file where I generate my graphs from my data: barplot(wmaefile$FC,xaxt="n",col="snow2",border="black", ...
2
votes
1answer
82 views

Avoid R output leaking into LaTeX with ggnet

Please consider the following MWE which I compile into a .tex document via knitr \documentclass{article} \begin{document} <<echo=FALSE, message=FALSE, warning=FALSE>>= library(igraph) ...
2
votes
0answers
76 views

knitr: Several figures with subcaptions, alignment issues

Here is a minimal working example: \documentclass{article} \usepackage{subfig} \begin{document} <<echo=FALSE,out.width="0.49\\linewidth",fig.show="hold",fig.align="center",fig.cap="Some ...
1
vote
0answers
60 views

Knitr and numbers

I return to a question, which is few months old and then maybe not yet the best practice around. I use the siunitx package in my documents along with knitr to compile my R chunks. As far as I ...
3
votes
1answer
78 views

Memory issue when producing dense TikZ figure (14500 points scatterplot) with knitr

I have a series of plots in my document which are correctly drawn by knitr with dev=tikz. Yet figure number 7, which is much more dense than the others in terms of data points, foo, doesn't: label: ...
1
vote
1answer
77 views

Cross-referencing tables generated by xtable

I'd like to cross-reference a table that I generated with xtable in R. I cannot able to. Here is what I did: \documentclass{article} \begin{document} Look at \ref{tab:mytable}. ...
2
votes
2answers
111 views

How does one set document class options (e.g. paper size) for LaTeX output?

The header option lets you insert TeX code in the preamble after \documentclass{article}, but what if I want to change the default paper size or the default font size? For this, I would need to ...
6
votes
1answer
159 views

How can I delete non-letter keywords (such as '<-')?

I am using the package to try and format my R code, and I don't like some of the things that are being treated as keywords (for the coloring scheme). However, when I specify deletekeywords={*,<-} ...
4
votes
1answer
226 views

A TeX translation of old C code - Evaluating elements of an array *inside* a foreach loop

I'm trying to translate a conceptually simple part of an algorithm, from the original source for the R-engine (written in C) to TeX. This shouldn't take more than some logic trees and for/while loops. ...
4
votes
2answers
116 views

Large image should ocupy all page without blank space around

I'm new to LaTeX and although my supervisor does not use LaTeX, I've decided to do my master thesis in LaTeX. However, I'm having a problem with the images. I have big images generated through R. ...
1
vote
1answer
96 views

Removing hline when producing latex code for table in R with Hmisc package

I have been struggling with this for some time and can't really find an answer. By default the latex command in Hmisc package cab generate code for table with hline on top, below header row and after ...
2
votes
0answers
160 views

Configure R Studio to use Biber for APA on Beamer Slides (Biblatex + Biber + R Studio + MiKTeX)

I'm trying to generate with R Studio a beamer presentation that uses backend=biber option. Here is my MWE: \documentclass{beamer} \usepackage[american]{babel} \usepackage{csquotes} %apa requires ...
1
vote
1answer
98 views

How to render LaTeX (math) in Sweave (R) code comments

background A asked this question on SO yesterday because it seemed to be more programming-oriented, but there weren't any responses. Perhaps someone here might have an idea? I am writing a Sweave ...
2
votes
1answer
104 views

Color the column of a latex table produced by xtable

How can I use the R xtable package to produce a table with a colored column? This post shows how to color a row, but I can't figure out how to do the same for columns.
1
vote
1answer
94 views

how do you put caption on figures in sweave

I have this sweave code. I need to add caption to the figures. I am doing this but it looks like I see the figure before the section{Data ANALYSIS}: \documentclass[letter,12pt]{article} ...
2
votes
1answer
57 views

Latex ifFileExist

\subsection{Checksum: Factor, Specific, and Total Variance} Perhaps the most basic test of a regression model is if the factor and specific variances sum to equal the total variance. Here, we ...
0
votes
0answers
52 views

Place multiple tables in a grid on a single page

I need to show several tables and figures on a single page. They are of different heights and widths and I would like to build a grid in which I could then put them. Is there a package that would ...
4
votes
3answers
104 views

knitr. Splitting a function into several blocks

Is it possible with knitr to split an R function across several blocks (for documentation reasons)? Here is a MWE: \documentclass{article} \begin{document} Part1 gives salutation. ...
2
votes
0answers
60 views

R figure to LaTeX - cloudy and diffuse text [closed]

I am a newbie to R and LaTeX, and cannot find any hint for my problem. Perhaps it is a silly question, but I tried to get a R-diagram into my LaTeX document without the axes out of focus. So far so ...
3
votes
2answers
85 views

Typeset R character vectors

I have two vectors in R that I want to typeset. The first vector includes the titles and the second the body texts. Please consider the following MWE \documentclass{article} \begin{document} ...
0
votes
1answer
159 views

“Math Processing Error” when processing LaTeX using knitr in R

I've never had any problem with my Latex appearing properly when using knitr before, but recently when I compile my document, I get this error: I'm not sure why this is happening. The error output ...
2
votes
1answer
86 views

Column Vector Sweave \Sexpr

I'm having big problems trying to compile a file using Sweave displaying a vector defined in an R chunk, as a column vector in Latex using pmatrix, I have something like this: ...
3
votes
1answer
116 views

How to plot barplot horizontally in LaTeX

I want to plot a barplot horizontally. I have tried using the following code, but it prints a vertical plot: \documentclass[varwidth=true, border=2pt]{standalone} \usepackage{pgfplots} ...
0
votes
1answer
92 views

Two graph - same page? (R/LaTeX)

I am using R to create my graph, and I am doing a paper, where I have to put two graph, as showed in the image: In R, my output looks like: y1 <- c(6524, 6701, 6946, 7080, 6920, 6887, 6660, ...
6
votes
1answer
885 views

How to include LaTeX package in R Markdown?

I am writing a report with Rmd in RStudio via knitr package. I want to write a indicator variable symbol in the report, like How do you get \mathbb{1} to work (characteristic function of a set)?. ...
1
vote
2answers
97 views

First row in second table created is blacked out

I am a LATEX/R/Sweave newbie and am encountering an issue while creating a report. The issue is that as shown in the figure below the first heading in the second table is blacked out. I am able to ...
2
votes
1answer
106 views

A program to export latex tables to excel/ods/csv?

I know there are tools to export excel tables to latex, but what about the other way around? I get a lot of latex tables from functions in R (e.g.: texreg) that aren't perfectly customizable via the ...
3
votes
2answers
187 views

TikzDictionary slow and blocking in knitr

I need to knit presentations with many slides and Tikz-plots. Knitr is fantastic for this, but it takes very long time and I cant knit two reports in parallel. I have isolated the problem to the ...
5
votes
1answer
422 views

Howto: Set up knitr (*.Rnw compilation) from in TexStudio

How do I set up TeXstudio to compile xxx.Rnw files? I am using the TeX-Editor TeXstudio 2.7, on Windows 7, and R 3.01 64-bit. I would like to write a xxx.Rnw-file in TeXstudio and then from ...
2
votes
2answers
311 views

Sublime Latexing and Knitr on .RNW files : Send lines to R console for evaluation

I am using Sublime Text 3 and the Latexing package to apply Knitr to compile .Rnw files that contain both Latex and R code. Overall, it works well in that I can compile the .Rnw files into PDFs ...
1
vote
0answers
112 views

R assignment operator (“<-”)

How does one typeset the R assignment operator ("<-")? Workarounds such as \begin{description} \item[x \textless{}- c(1:3)] Create the vector [1 2 3] and assign it to an object named x. ...
7
votes
1answer
457 views

Best Practice for nice layout with tikzDevice

R+tikDevice+LaTex+knitr is (as I understand it) the most efficient way to get relly nice looking publications from R, with maximum layout-support from LaTeX. I'm using R+LaTex+knitr now, but would ...
4
votes
1answer
191 views

inline knitr code that isn't a simple number

It is easy enough to do something like \Sexpr{1 + 1}. But how can I do \Sexpr{mymatrix} with mymatrix being a matrix object in R workspace? More generally, how can I print object that is more complex ...
1
vote
0answers
58 views

Table-caption rotated wrongly

How can the table-description in tufte-handouts be placed correctly with sideways-tables and xtable? See following minimal reproducible example where the figure-description is corrrect (stolen from ...
7
votes
4answers
184 views

tikz has probably problems with czech babel when compiling .Rnw

Problem Tikz seems to have a problem with \usepackage[czech]{babel}. I had a moderately big .Rnw document written in czech with some plots via knitr chunks. When I set dev = 'tikz' the TeXmaker ...
0
votes
1answer
53 views

Chunk of text on the right of a picture

I have a portion of a latex document that is similar to: \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor} \includegraphics[width=0.5\linewidth]{figure/plot} \hfill{} ...
2
votes
1answer
1k views

Controlling formatting options for xtable

All, I'm a LaTex/knitr/Sweave amateur and have had trouble finding answers to what seem like they should be fairly simple questions online. I have a .Rnw script that I am currently compiling to PDF ...
1
vote
0answers
34 views

Include .Rtex as a chapter in latex

I have an Rtex that contains: \documentclass[openany]{book} \chapter{Introduction} \input{./Introduction/Introduction} \chapter{Thesis Outline} \input{./Outline/Outline_Chapter} ...