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

2
votes
0answers
15 views

Font size of references list in Pandoc

I am using RMarkdown to make a document with references from a .bib file as shown below. How can change the font size and line spacing of the references list printed at the end of the page --- author:...
1
vote
0answers
19 views

xtable, via knitr, inside multicols

How can I put an xtable (made with knitr) in a multicols environment? The table is working outside multicols, but when I place it inside multicols it disappear. I've tried with lstlisting inside ...
3
votes
1answer
84 views

Fonts in latex and R [closed]

This question could be linked to this, this and this. However, I opened a new one because I tried two different options from the suggestions and getting different results. The aim is to get ...
2
votes
1answer
29 views

listings with R: keywords in variable names are highlighted when using underscores?

When using language=R as a lstlistings style, if a variable name contains a keyword surrounded by underscores it will be highlighted. See the image and code example below. What can I do to prevent ...
1
vote
0answers
20 views

pdf error when compile a knitr figure chunk

I am getting !pdfTeX error: pdflatex (file D:/project/figure/plot-1.pdf): PD F inclusion: required page does not exist <0> ==> Fatal error occurred, no output PDF file produced! when ...
1
vote
0answers
18 views

Adjusting the text width of R listings in LaTex

Hi I have R codes that I am listing in my LaTex file with \begin{lstlisting}[language=R] R code \end{lstlisting} I have no specific listing setting in my preamble. My R code is very wide and ...
2
votes
1answer
15 views

Knitr/Sweave Format Code Output w/ Leading Characters

Using knitr/sweave, I need to format the R code output that gets echoed, according to editorial journal requirements. For example, the following chunk <<example,echo=TRUE>>= library(plyr)...
3
votes
0answers
47 views

glossaries with tikzDevice

I am using tikzDevice to run my R-scripts within latex. This is my code -- \documentclass{article} \usepackage[acronym]{glossaries} \usepackage{tikz} \makeglossaries \newacronym{gcd}{GCD}{...
3
votes
1answer
61 views

No increment of a variable in a Sweave code chunk which is wrapped by a \whiledo loop

I already searched in different forums but until now I couldn’t find a solution. So I hope that you can help me… Like mentioned in the title there is no increment of my variable x in the code chunk ...
1
vote
1answer
45 views

MikTeX won't let me install packages

I'm trying to learn how to use TeX within R. I've downloaded R, RStudio, and proTeXt. When I try to compile it, I receive a message that I am missing several packages; however, when I try to find a ...
1
vote
0answers
41 views

Trouble getting tikzDevice to work at all

Have used TikZ extensively over the years (MiKTeX is my LaTeX distro of choice), and recently, thought I'd try my hand at 'exporting' R graphics -> LaTeX used tikzDevice, which some folks have found ...
2
votes
1answer
76 views

Tables with reference to R objects in sweave / latex

I'm using knitr/R-sweave to produce a pdf-document wit LaTeX-code. I want to make a table with some numbers produced by some R calculations in the R-code-chuck above this table. When I usually want to ...
0
votes
0answers
25 views

What does “LaTeX Error: Environment rmdtip undefined.” mean?

I am trying to build a book using bookdown::render_book() command in RStudio. However, it stops working after the pandoc step almost at the end of the process: "K:/Program Files/RStudio/bin/pandoc/...
1
vote
0answers
44 views

Produce multiple documents using a loop in LaTex

I want to produce multiple documents in LaTeX. There is a list of values for every document that should be created, in the example it´s \mylist. My first approach was to use the \foreach function to ...
2
votes
1answer
67 views

How to create a latex table in R with significance stars?

I have a latex table generated as following in R: \documentclass[12pt,econ]{authesis} \usepackage{natbib} % natbib citation style \usepackage{url} % added 2015-067-06 bc the example .bib ...
1
vote
1answer
34 views

\lstinputlisting with R problem

I'm trying to include my R code in a Lyx document but get the following error when trying to convert to PDF: \lstinputlisting{MonteCarlo.R} ^^M *** (cannot \read ...
1
vote
0answers
62 views

general footnotes in xtable

I am using sweave to create pdf. Using xtable, I am trying to insert a general footnotes under the table (i.e: This symbol means bla bla bla). I've tried a lot of things and everything get me an error ...
1
vote
1answer
51 views

make the TeX xtable results well formatted and easier to read

Is there a way to make the TeX xtable source code results well formatted and easier to read. Example: library(xtable) ## Load example dataset data(tli) print(tli.table) gives \begin{table}[ht] \...
0
votes
0answers
17 views

mtable into LaTeX: ! Missing } inserted.<inserted text>}

I am trying to write my thesis with LaTeX (first time using it) and I am struggling with making some tables. I am using toLatex in R to produce an mtable, which gives me the following code: \...
2
votes
1answer
21 views

Set TeXstudio for Unicode .Rnw files (Sweave)

I tried to run Sweave on a .Rnw file from TeXstudio, but the unicode characters don't show up in the .tex file when I typeset with xelatex. My user command is /usr/local/bin/Rscript -e "Sweave('%.Rnw'...
2
votes
1answer
136 views

2D correlation plot matrix with shapes

Is there a straightforward way to create a correlation plot matrix similar to the figure below? The image is an example of R's corrplot package using circles, which also offers other shapes and ...
0
votes
0answers
43 views

How to create an index for a book that includes code chunks

I'm in the process of creating an index for a book that includes R code chunks. I'd like to include certain R functions that appear in these chunks in the index, so I assume I have to place the \index ...
0
votes
0answers
34 views

dplyr Tables latex problem

Can you explain why the caption of the table is not appearing in the example below. All works fine except the caption \begin{center} <<echo = FALSE>>= library(dplyr) myTable <- as....
2
votes
1answer
96 views

siunitx: What is the correct way to output mean and standard deviation as “M (SD)” in an S-column?

I am trying to use siunitx in a psychology results table to line up decimals, and the table looks like this: \documentclass[]{article} \begin{document} \begin{table}[h] \begin{tabular}{@{}cc@{}} ...
4
votes
3answers
123 views

How to extract a series of text not in an environment, but with defined commands enclosing them

Under Windows 8, I am using R and the knitr package in RStudio with an .Rnw script. My regex skills are passable, but only in R. My document has about thirty pages with a different text section at ...
1
vote
0answers
82 views

Writing R code in TeXstudio

I have one chapter of my document which include R code. Whole document is written in TeXstudio. I need help regarding writing and executing R code using Texstudio. Regards
1
vote
2answers
89 views

How to avoid page break after table?

I have a small LaTeX table (tabular) created in R with the xtable package and I would like to place a figure underneath the table on the SAME page. I have tried various things (using packages float, ...
1
vote
1answer
48 views

Following .Rnw works fine in RStudio but throws error in LyX

This .Rnw compiles fine in RStudio Version 0.99.862 \documentclass{book} \usepackage{Rd} % Rstudio will be able to find this .sty file \begin{document} <<label=Test, echo=FALSE, results='...
1
vote
1answer
172 views

How to align multiple equation using tcolorbox in latex enviroment for Rmarkdown

I have the following latex inside Rmarkdown: \begin{tcolorbox} \begin{equation} \sigma = \beta_{0} \label{eq:Model0} \end {...
1
vote
1answer
84 views

Including TikZ picture in Sweave gets me an overfull box error

I have some difficulties in R Sweave so I hope someone could help me. I want to include two TikZ pictures using minipage and figure to the R Sweave but I get an error: Overfull \hbox (2.43085pt too ...
1
vote
2answers
83 views

Where set font in tikzDevice-plots (.Rnw)

I'm trying to use sans serif fonts for the text in plots (ggplot2) made by R, within KOMA-book. Unfortunately I'm not very experienced in managing fonts and their families. To keep things consistent, ...
1
vote
1answer
264 views

Sweave R code chunk default colors in vignette

Typically, if I create a .Rnw file and add R code chunks to it, and then convert it to .pdf file, the R code text will have default color and font than the rest of the document text. An example ...
29
votes
4answers
938 views

Literate R Programming

I'd like to embed some R into a LaTeX document. After a bit of googling I found that Sweave and knitr allow you to do this. I compiled a simple example with Sweave and it works. I'd be much obliged ...
1
vote
0answers
533 views

align, aligned and R Markdown

I have been working in R Markdown, which supports LaTeX, including in display mode. I had the following snippet for displaying aligned equations $$ \begin{align} a_1 &= \beta_0 \\ b_1 &= \...
3
votes
1answer
59 views

Conditional evaluation of Sweave chunk

I'm using some R code to import and manipulate a time series. The code takes some minutes to run and, as a result, it generates a relatively small time series. Now, to prevent typesetting to take an ...
2
votes
1answer
68 views

Insert line break into knitr fig.cap?

I am using knitr and want to insert a line break in my fig.cap chunk option. Is this possible? The following is all I can think of but it doesn't work. I expect there's some evaluation option but I ...
5
votes
2answers
455 views

Using LaTeX font in R (Computer Modern)

I am looking for at way to plot graphs in R, using LaTeX fonts. In the documentation for pdfFonts in R, it states that: There are also mappings for "ComputerModern", "ComputerModernItalic" and, ...
2
votes
0answers
59 views

What is the counterpart in LaTeX for the R package ezknitr and its tools for managing paths and directories

Dean Attali has just added an R package called ezknitr to CRAN. It enables those who use knitr and RMarkdown in .Rmd files to handle directories quite flexibly. His blog describes it well: path ...
2
votes
0answers
25 views

Graphics prepared with Sweave and text disorder

I am preparing a report using Sweave, it is really beautiful, but the first introductory words of my pdf-file appear after the first R-plot! How to fix it? I would like to add that I've already tried ...
1
vote
0answers
751 views

Error 43 while knitting a markdown to pdf in a R project created on mac and run on Windows

I created a R project which outputs some plots to pdf using rmarkdown::render with an .Rmd file. I shared the folder when the R project and all the relative files are kept to a colleague using Google ...
0
votes
1answer
218 views

Error in compiling LaTeX (bmcart.cls not found)

I'm a complete beginner to LaTeX. I want to try a latex template, so I: Created a new R Sweave file in RStudio Copied and pasted the source in https://www.overleaf.com/latex/templates/biomed-central-...
2
votes
2answers
89 views

With knitr and LaTex, how can you arrange the List of Figures alphabetically?

What code will enable me to reorganize the List of Figures alphabetically (and keep the page number)? My goal is to include that alphabetical listing of figures in the PDF file that is created. Here ...
2
votes
0answers
53 views

Knitr Plot Tooltips for ADA Compliance

I would like to use Knitr to generate plots in R that have hover-over tooltips. Here is a working example without an R tooltip: \documentclass{article} \usepackage{pdfcomment} \begin{...
0
votes
0answers
34 views

How can I have the Latex structure in knitr?

how can I have the same structure, I mean: \section, \subsection, ... in knitr or Markdown? Is there any possibility to include every section in a separate file like in latex? \section{...
2
votes
0answers
108 views

Extra Curly Braces when creating Xtable using Knitr, after specifiying size

I'm creating a R Markdown document using knitr and am running into trouble using xtable to create a table. My table is very large and I'm trying to reduce the size using the size command in the print ...
8
votes
2answers
250 views

Encrypt and decrypt parts of text in a LaTeX source file

Assume that you have some text in parts of your LaTeX document that you only want people with a password to see. A reason could e.g. be a case with an guiding answer. You want to make the case public ...
2
votes
0answers
64 views

tikzDevice in R, set absolutlely all fonts, fontsizes and fontweights to TeX document fontsize

I am learning R, and I want to use tikz to inlcude R plots in my documents. However, to me, half the point is that I want to set absolutely all typefaces, fontsizes, fontweights to the TeX-document ...
2
votes
1answer
43 views

Setting up winefish to compile sweave

The winefish latex editor has a "texbox" field in the preferences window, which tells it how to do various things, like PDFlatex for example. There is something about regular expressions, a command ...
0
votes
0answers
93 views

Knitr not available in LyX (Windows)

I installed LyX with MicTeX on my pc. I installed the Knitr module. So I see in the packages in R studio that I can add 'Knitr'. After that i added the path of R.home('bin') to the PATH in the ...
2
votes
2answers
223 views

Running R code from latex. (alternative to knitr)

If you want to export the output of an R script to latex and create a pdf document you can use the package Knitr with RStudio. But I guess this is only a good practise for short results. What if I ...