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 ...
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 ...
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
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-...
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 ...
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?
0
votes
1answer
99 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 ...
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
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
34 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
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 ...
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: - \...
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....
2
votes
1answer
95 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 :(
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
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
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, ...
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-...
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 &...
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 ...
0
votes
1answer
243 views

Return to regular alignment after centering equations in R markdown

the text in R markdown is below. I am trying to export to a pdf. Another benefit of the multi-level model is its hierarchical structure. In this case, most games against opposing teams are played in ...
4
votes
1answer
540 views

Using biblatex with R Markdown

I am trying to compile a PDF Output with an R Markdown file and build my bibliography with the biblatex package and using R Studio. Here are my code/files in index.Rmd --- title: | Hello World! ...
3
votes
0answers
110 views

Including an Rmd file in a Rnw file using pandoc

I was trying to follow this example that shows how to write a separate chapter in RMarkdown and then include it in your main RNW file using \include{}. However, I have not been able to get pandoc to ...
0
votes
0answers
79 views

I get an error every time I try to run my Latex document in Texmaker, using a chunk code from R

I'm following the following guide: https://joshldavis.com/2014/04/12/beginners-tutorial-for-knitr/ I've installed the knitr package and run it in R, and I'm trying to copy and paste the example from ...
2
votes
1answer
330 views

Option clash with RMarkdown and beamer

I work across two separate Mac computers, a Macbook Pro at work, and a Macbook Air at home. Both macs are running identical operating systems. I am writing in RMarkdown, using knitr to compile beamer ...
1
vote
1answer
807 views

Line spacing 18 pt in r markdown [duplicate]

Iam writing my thesis in r markdown and want to change the line spacing to 18 pt. But i cant find a solution for it. I only found the setting for onehalf spacing or 1.5 spacing but no for exactly some ...
2
votes
1answer
282 views

i trema doesn't appear in RMarkdown LaTeX document

I'm trying to write about naïve modeling, and have written the following header: ## Na\"{i}ve Modeling That, however, and all variations like it, produce only something that looks like this: Na"{...
1
vote
1answer
203 views

R code (ggplot) not outputting to .tex file

I'm relatively new to this so possibly a duplicate question but I am trying to use library tikzDevice to add a ggplot figure to a LaTeX document as per this guidance: http://iltabiai.github.io/tips/...
2
votes
1answer
784 views

Can TinyTeX replace MiKTeX or TeX Live

On Windows I use MiKTeX and TeXstudio. On Linux I use TeX Live and TeXstudio. I don't write much in LaTeX. I write a lot in R Markdown. R Markdown output to pdf works best (for me) with TinyTeX LaTeX ...
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(...
1
vote
0answers
2k views

R Markdown and Latex: Change font family and size for table of contents

I am trying to create an automated report in rmarkdown for business partners and I am a bit stuck on how to alter the table of contents. Essentially, I would like the table of contents to have a ...
3
votes
1answer
93 views

Plot symbols not showing properly using R + knitr with 'pdf' device

When I include R plots in a latex document using knitr, symbols do not show properly when knitr's graphic device is 'pdf', while everything is OK when the graphic device is 'png'. Here is a MWE: \...
0
votes
0answers
198 views

Centering the figure caption when switching page orientation

I'm a newcomer to Latex but I've already found it very useful. I have a document that requires me to switch the orientation from portrait to landscape midway through the document so I can properly fit ...
2
votes
2answers
258 views

Automatic bibliography by DOI

I would like to know if it is possible in LaTeX to automatise the bibliography. For example, I would only put the DOI link in the bibliography and latex would take all the info (author, date, title ...
1
vote
1answer
705 views

How to get LaTeX math into Legend of R plot

I'm trying to add a latex math expression to the legend and labels of a chart made in R but haven't found any examples where this has worked. For example, my y-axis label should be like "Availability,...
0
votes
1answer
2k views

How to reduce intercolumn space with stargazer

I have been navigating around for some time, trying to find the answer to my problem. I have made a few regression in R and want to export them with the stargazer package into LaTeX. However, ...
3
votes
2answers
1k views

Left Quotation Marks when using RMarkdown and knitR

Normally when you want left quotation marks in LaTeX, you type the following: `` However, in RMarkdown, you will trigger a block of R code to run when you type two pairs of backticks on the same ...
2
votes
1answer
1k views

How to make cross-references to sections/figures before they are introduced in R Markdown?

I'm using Rmarkdown and Bookdown to write an article. The issue I'm running into is with cross references and the order of introducing them and referring to them. For example, in this paper example, ...
2
votes
1answer
2k views

pdflatex problem with Rstudio

I'm trying to compile a simple Rnw file in Rstudio using knitr "compile pdf" functionality. But it gives me an error. This is what I have in hello.Rnw: \documentclass{article} \begin{document} ...
0
votes
0answers
268 views

R code in LaTeX in YAML before_body include

I have a LaTeX section that I put at the top of my knitr generated PDF document. I achieved this by using the YAML options output: pdf_document: includes: before_body: file....