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
1answer
21 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@{}} ...
5
votes
3answers
76 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
votes
0answers
49 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
43 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
31 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, ...
1
vote
1answer
40 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
49 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
0answers
26 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
43 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 ...
22
votes
3answers
640 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 ...
0
votes
0answers
75 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
28 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
28 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 ...
2
votes
1answer
86 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
37 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
21 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
115 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
67 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 ...
3
votes
2answers
57 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
36 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} ...
0
votes
0answers
27 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? ...
2
votes
0answers
33 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
158 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 ...
1
vote
0answers
29 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
32 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
36 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
117 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 ...
2
votes
2answers
93 views

Citations in tabular environment not working

I'm writing my thesis with Rmarkdown but with a lot of LaTeX mixed in. When I compile the document, all my citations appear just fine, but those in my table appear as [?]. I have tested different ...
1
vote
0answers
46 views

R, Metafor package and Latex output

I have a problem in exporting output produced in R using the metafor package to latex. The object I'm trying to export are few rma and rma.mv outputs. As example, I'll post some output of the rma ...
0
votes
0answers
94 views

How can I set formatting options for an .Rmd outputting to .pdf

I have a .rmd in r studio. This is being compiled by the r package knitr into a pdf via the pdfLaTeX engine. DISCLAIMER: I am very new to LaTeX, and have been searching for days without luck on how ...
3
votes
2answers
120 views

points of R plot (saved to pdf) are not showing up with pdflatex

I am generating a pdf plot with R: library("ROCR") p <- c(0.226809355461365, 0.230331183191861, 0.245193329547248, 0.230982114615013, 0.231497802927267, 0.2296662312173, 0.224856867748048, ...
0
votes
0answers
223 views

Encoding error when knitr -> LaTeX -> PDF

I have a document written in knitr. I can export it to HTML and docx, but not PDF for some reason. The Rmd file is here http://cl.ly/dJka?_ga=1.30252732.2076817589.1442770201 It says ! Package ...
0
votes
0answers
58 views

R to LaTeX with knitr and pandoc (error in a guide)

I want to follow the guide http://kieranhealy.org/blog/archives/2014/01/23/plain-text/ since my document http://rpubs.com/lindberg/110268 need to be pushed to latex for a better read. The tex says ...
0
votes
0answers
48 views

How to create tikz figures via knitr forcing labels featuring LaTeX's font size modifier-commands?

Is there a way to force knitr to create tikz code which includes font size information? The output would be something like this: \begin{tikzpicture}[every node/.style={font=\footnotesize}] Here is ...
1
vote
0answers
87 views

ShareLatex knitr install package

Sharelatex comes with a few R library's that you can query. However, it is impossible for me to install a package or query a non pre-installed package. The package I am trying to use is the arm ...
1
vote
1answer
74 views

knitr creating a wrong second “#” in a deep hyperlink

I would like to compile a .Rnw Document in RStudio with knitr that includes a "#" in the hyperlink (deeplink) of a float caption. See the minimum working example: (compiled with R Studio Version ...
4
votes
1answer
292 views

How to draw a function like sin(x)~cos(x) in tikz/pgfplots?

In R it's easy to do something like x <- seq(0, 2*pi, 0.01) plot(sin(x), cos(3*x), type='line') to get the plot How can I make such a plot using tikz/pgfplots?
0
votes
0answers
47 views

Repeat beamer frames and R chunk

I'd set up a loop for multiple beamer frames and a R chunk within the loop too, but it always does work. The R chunk in the loop wasn't run by R. <<echo=F,results="asis">>= ...
1
vote
1answer
38 views

missing minus sign in R code using latex

I'm using lstlisting to include my R code in my LaTeX, however, the minus sign after < is not appearing in the compiled file. \usepackage{listings} \begin{document} \begin{lstlisting} ...
11
votes
1answer
95 views

How to incorporate a TEXMF tree managed by distro's package manager when using TeX Live from upstream on a GNU/Linux system?

I am using upstream's TeX Live on a GNU/Linux system with default paths except for the use of symbolic links to facilitate switching between different versions of TL. So, for example, TEXMFMAIN is ...
1
vote
1answer
67 views

Setting width of page

I would like to control the width of the document, i was able to set the margins more the the left (https://stuff.mit.edu/afs/sipb/project/www/latex/guide/node30.html) But that just moved the text to ...
2
votes
1answer
61 views

How to add packages in tikz using R

I wrote the following commands in R to generate a picture. However, the y-axis label is missing as the picture below shows. There seems to be some error in ylab="$\\ln \\mathbb V ...
6
votes
2answers
120 views

Three dimensional Regression Plan with Residuals

In R, I can make three dimensional Regression plane with residuals with the following command scatter3d(prestige ~ income + education, data=Duncan) with scatter3d function from car R package. I ...
2
votes
1answer
59 views

Lyx / Knitr - R Code in chunck goes beyond set width

I use Lyx (2.1.4) with knitr (1.10.5). I have a lot of trouble having the code chunks respect the width that I tried setting through various ways: In the chunk options (width=50); ...
0
votes
1answer
66 views

knitr example doesn't produce graphics

I tried compiling the given MWE for testing knitr: %% LyX 2.1.3 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. ...
1
vote
1answer
41 views

How does knitr inject TeX code into the document?

I'm very new to knitr. How do I write R code in knitr that composes LaTeX from scratch and injects it into the document at a particular point? I'm thinking of something similar to what PHP or JSP ...
1
vote
1answer
262 views

Sweave-generated pdf-figure has two pages instead of one, with the first being empty

Using Sweave() in R I am trying to include a ggplot2-graphic generated by marrangeGrob() from the R package gridExtra into a pdf document. The problem occuring is that the pdf containing the figure ...
1
vote
1answer
215 views

Knitr pdf not working on Mac OS X error “! Missing $ inserted.”

I have the following chunk in rmarkdown {r } library(psych) a <- (matrix(c(1:1000), ncol=4)) f <- fa(a) But when I try to print inline the following output: `r f$null.chisq` I get the ...
0
votes
0answers
102 views

best way to capture R output into latex table

I am running a bunch of models in R using the caret package. This package is an interface to many modeling techniques and methodologies. There are certain output of each model I'd like to convert to ...
6
votes
1answer
411 views

New R Logo with Tikz

I want to make the following new R logo with tikz. My MWE with output is: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[] \node[blue] at (0,0) {R}; \draw ...