Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [r]

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.

0
votes
0answers
24 views

Latex with rmarkdown (RStudio)

What must I do? This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6930 64-bit) entering extended mode Sorry, but C:\Users\Silvano\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex....
1
vote
2answers
35 views

Environment undefined ONLY when referencing a preamble.tex

I'm trying to use R Markdown to typeset some notes and I'm having difficulty using the \adjustwidth environment. The issue only arises when I reference some preamble.tex. For instance, if I have a ...
0
votes
0answers
15 views

Indexing terms being used in cross-referencing

This is a follow-up question of my previous one: Cross-referencing numeric values and text from later section to executive summary of a latex document I have finished making my report and now my boss ...
2
votes
1answer
23 views

How to add page numbers to inline references using csl in rmarkdown?

I am using RMarkdown in RStudio to reference multiple sources out of my .bib file with csl (see below). My .Rmd doc: --- title: "mytitle" author: "nunberg" date: '01\.01\.2019' output: ...
1
vote
1answer
24 views

How to cite german book titles properly (upper case) with csl and rmarkdown?

I am using RMarkdown in RStudio and want to cite several sources using csl, specifically I use the style "elsevier-with-titles.csl". I want to cite a german reference, so title must have upper case ...
2
votes
1answer
852 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@{}} ...
0
votes
3answers
70 views

Can I type \LaTeX inside inline code in Rmarkdown?

I know I can use $$ to write \LaTeX in Rmarkdown documents like $\beta$. My goal is if this is possible inside inline code. I would do `$\beta$` or `$\\beta$`, but both do not work. In case it is ...
0
votes
0answers
41 views

Having problems with LaTeX coding in Rmarkdown (fancyhdr, \headheight)

I'm currently having an issue with latex in Rmarkdown (using fancyhdr package). I am trying to make a data report with a certain template style. This is a screenshot of the pdf at its current stage ...
0
votes
1answer
56 views

Reporting R Results in LaTeX

I´m writing my thesis in LaTeX (using Overleaf) and I analyzed some data in R. So I have a R script where I perform a bunch of tests and regressions. Now I want to e.g. include the t-statistic and p-...
2
votes
1answer
66 views

How to center and flush right cells in a column

I am trying to create a table with a numeric column number which I wish to center and flushright content as follows: Using RMarkdown, I am only able to wrap LaTeX code around/inline with cell content ...
0
votes
1answer
33 views

How to use if-else statements in sweave documents

Is there a way to use an if-else statement in an sweave document, so that a figure is only shown depending on the value of an R object. I tried different approaches (two of them are below), but I did ...
0
votes
1answer
98 views

R Markdown preview LaTeX by scrolling over

I believe in the past I have been able to preview my LaTeX code in R Markdown by just placing the cursor over the LaTeX chunk, but right now I'm unable to recreate that. Any idea how to turn that back ...
1
vote
1answer
43 views

Importing entire R Script file into Latex

Is there a way to import an entire RScript (.R) file into Latex directly without manually using listings and copying the code into Latex?
2
votes
1answer
783 views

R-code linebreaks AND themes in knitr

hpesoj626 provides two great minimal working examples for how to get R-code linebreaks AND code highlighting in knitr. I was wondering if it was possible to use Yihui's knitr themes within either of ...
0
votes
1answer
35 views

Table of contents in Beamer R Studio

i'am trying to generate an beamer presentation but i can't add an Ouline of my document: this is my code: --- title: 'PEC-3 Gestión Económico-Financiera: Casos de Negocio. El sector de la ...
0
votes
1answer
132 views

mathbb not working and mathbbm/mathds not compiling in rmarkdown [closed]

I'm trying to get the math 1 character in an rmarkdown file. \mathbb{1} just produces a simple 1, and \mathbbm{1} / \mathds{1} does not compile for some reason. title: "A3" header-includes: - \...
13
votes
3answers
15k views

Latex Error: 'Sweave.sty' not found?

I downloaded the most recent version of Miktex Basic Installer (2.9.5105). After following the Miktex's instructions, I began working through Nicola Satori's Sweave Tutorial. The R portion of ...
9
votes
3answers
3k views

Compiling latex directly from R

I want to find a programmatic way of converting a .tex latex document to pdf. What I usually do, and this works in most cases, is to use: tools::texi2dvi(latexfile, pdf = TRUE, clean = TRUE) ...
5
votes
1answer
7k 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 &= \...
0
votes
2answers
42 views

side by side tables latex - without \floatrow

I have the following simplified document (): \documentclass[10pt]{book} \usepackage{float} \let\origfigure\figure \let\endorigfigure\endfigure \renewenvironment{figure}[1][2] { \expandafter\...
0
votes
1answer
159 views

How to write y i = β 0 + β 1 x i + β 2 x 2 i + e i in Latex code? [duplicate]

I'm a beginner of using R and Latex. Just wonder how to write yi = β0 + β1xi + β2x2i + ei by using Latex?
0
votes
1answer
27 views

Sweave child rnw losing formatting

I have managed to get a master.rnw include a child.rnw, however, I can maintain the formatting of the child document based on the preamble in the master. Master.Rnw \documentclass[11pt,a4paper, ...
0
votes
0answers
45 views

Converting Tab-delimited reference list into a bibtex format (using R?)

I need to export search results from Web of Science (i.e. all the results of a query, 100s of entries) and import them in Mendeley with their abstract. while I usually can export a citation in a .bib ...
2
votes
1answer
122 views

Getting R xtable to display within a LaTex 'minipage'

I have the following piece of R-markdown / latex / minipage combo code. What I am trying to do is get the xtable output to display within the minipage, along with other text paragraphs surrounding it....
3
votes
1answer
170 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} \bibliographystyle{...
0
votes
1answer
341 views

Sublime Text 3, LaTeXing, and R

I have been using Sublime Text 3 in conjunction with the LaTeXing and R-Box packages to write/compile .Rnw files. Everything was working fine until I updated to a newer version of R (3.4.3). I have ...
0
votes
1answer
1k views

pdflatex from MikTex not working inside windows

I am trying to compile some tex files into pdf files using pdflatex but it is not working. Can anyone spot what the problem is? I appreciate any kind of help. I was first trying using R but it seems ...
2
votes
1answer
151 views

Output from for loop in LaTeX table

I have a for loop in an R file and I need the output of for loop to be stored in a table for LaTeX. I know about the table package, but I can't figure it out. My code goes as follows: for(i in seq(...
0
votes
1answer
35 views

Tikzdevice with ggplot: overfull hbox

I have the following R code to generate a tikzdevice plot: tikz(file = "plot_CIs.tex", width = 5, height = 5) par(cex = 0.8) ggplot(confidence_interval, aes(x = Statistic, y = Values, group = 1)) + ...
0
votes
1answer
494 views

How to replace a string in \Sexpr by a variable

I am using latex to automate reports. In R, I create a data frame that contains all of the metrics and then using \Sexpr I filter that data frame for a specific metric. Currently, I have this: \...
0
votes
1answer
331 views

Horizontal alignment of 3 elements in footer of a PDF output from RMarkdown using LaTex

How do I fix the horizontal alignment of my footer in a PDF file produced from an R Markdown using LaTex? Here's my header.tex file: \usepackage{graphicx} \usepackage{fancyhdr} \fancyhf{} \...
1
vote
1answer
420 views

R code and Sweave output - EDIT

UPDATED Question 1 In the lattest update of KnitR the output is clean as what I expected. Maybe an update was made. The new output : Before update I'm trying to get a particular output with Sweave ...
2
votes
1answer
94 views

Caption in Sweave after an R plot

I have the following R chunk: <<echo=FALSE>>= par(mfrow=c(3,1)) #cas basal: no negra no fumadora sense prematurs ni hipertensi? lwt.pred<-seq(80,250,1) prob.pred<-0+model.final$...
0
votes
1answer
33 views

How to set roman font to make references to R? [duplicate]

I'm writing a thesis and I need to make references to R. I've read some other articles that cite "R" and they seem to use the roman font. I have no idea how to set this font :(
11
votes
3answers
8k 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, ...
1
vote
1answer
352 views

Undefined control sequence in R markdown

I have got stuck on this code which I could not be able to find that in my content anymore after checking for more than two times. Is there any packages I should have updated? As I am using TexShop ...
0
votes
1answer
3k views

R Stargazer output unable to run in LaTex editor

TexMaker displays an error message when I run this code, stating that the first line "\begin{table}[!htbp]\centering" is causing issues. Any insight is appreciated. \begin{table}[!htbp] \centering \...
2
votes
1answer
74 views

How to avoid problems with diacritics once and for all

I work with Rnw, and I type in Catalan, so there are diacritics I wouldn't encounter in English. I just want two things: That when I compile my PDF, all diacritic letters are as they should be. That ...
0
votes
1answer
34 views

creating multiple generic letters from pulling info from an excel/csv file

I wanted to create 100 invitation letters for a group of 100 people whose name and phone number I have in an excel sheet. I have written one generic letter and wanted to the put in the name and phone ...
1
vote
0answers
61 views

Problem with out of KableExtra tables with LATEX in Rstudio: paste0 function

This is my Rsweave reproducible example: \documentclass{article} \DeclareUnicodeCharacter{3B1}{$\alpha$} \DeclareUnicodeCharacter{3C4}{$\tau$} \DeclareUnicodeCharacter{3C3}{$\sigma$} \...
0
votes
2answers
58 views

Making TeXLive Bera Font Accessible on MacOS/R/etc

I used to be able to create R graphs with texlive's bera .pfb font on macos. Alas, somewhere along the line, it stopped working. (I am asking in https://stackoverflow.com/questions/53089029/using-...
2
votes
1answer
209 views

Tex code generated with R huxtable package has parts of it displayed in the output

I have some trouble with the generation of a standalone pdf of a table in a R script. I use huxtable R package to create a "latex" table from a regular R matrix or dataframe. Hereunder is a very ...
21
votes
7answers
9k 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 ...
4
votes
1answer
738 views

Iterating through a character/string array in LaTeX

I have an array of strings, and am trying to output each element into LaTeX. I am able to achieve that using the following code: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage[T1]{...
7
votes
1answer
131 views

How can I use Context and R together?

I am using conTeXt to create pdfs (I need to use Context rather than any other latex engine because I am using their tagging feature to create pdfs with tagged document trees). I would like to be ...
0
votes
1answer
179 views

Array command in Latex

I wonder may I ask about why I received the error note from R-Markdown that ! LaTeX Error: \begin{array} on input line 569 ended by \end{equation*}. #1, Let X = \[ \left(\begin{array}{cc} 1 &...
73
votes
3answers
90k 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)?. ...
10
votes
3answers
823 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 (0,0)...
7
votes
1answer
584 views

colour R code to match knitr theme using listings, minted, or other

with the listings package, and the help of this answer and this answer, I can include R code in my LaTeX document that looks almost like what knitr produces natively. However, as I am combining a ...
0
votes
1answer
254 views

Loading Custom Fonts into RMarkdown

I've been testing loading my own fonts into a personal rmarkdown document using the fontspec latex package. Because I'll eventually need to knit this on a server, using the font library on my mac is ...