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.

Filter by
Sorted by
Tagged with
2 votes
1 answer
412 views

Using tikz with \pause command in rmarkdown or quarto presentation

I'm trying quarto for my slides and wondering how to use \pause in tkiz code. Minimum working example (Test.qmd) is below for reference. --- title: "Test Slides" format: revealjs: ...
1 vote
1 answer
108 views

Illegal parameter number in definiton of beamer frame RMarkdown

While I want to render my Rmarkdown file as beamer pdf with Latex. I get the error: !Illegal parameter number in definiton of \beamer@doifinframe I get this only within the columns Tag. --- title: &...
0 votes
0 answers
37 views

How to correct !Undefined control sequence error created by \definecolor? [duplicate]

I'm trying to create a pdf table generated in latex format in R, but any of the commands below generates and !Undefined control sequence error. I tried removing this line or putting it below the \...
1 vote
2 answers
1k views

R markdown / Plotly R with LaTeX unable to generate plot and get error on a file name with hyphen

I am using LaTeX for some formatting, and trying to generate a PDF file with a plotly R plot as a png. The following piece of code gives me an error as show below. It seems like a problem with the ...
3 votes
2 answers
3k views

Wide table problem when generating PDF

I have a LaTeX wide table generated from a data frame in R using xtable, but when the PDF is created not all the data is shown, just a part of it, and the other part is hidden on the right of the PDF. ...
0 votes
1 answer
169 views

unable to compile quarto document using kableextra and table caption

I have been trying out Quarto as a replacement for RMarkdown for writing reports but come across some problems with tables. The main issue seems to be that I cannot get it to compile if I am trying to ...
212 votes
27 answers
111k views

Workflow for converting LaTeX into Open Office / MS Word Format

I often have to write up reports based on the analysis of some data. I use R to analyse the data and export tables, figures, and text. This is then included into a LaTeX document either using input or ...
0 votes
1 answer
2k 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 ...
1 vote
1 answer
666 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: \...
1 vote
1 answer
522 views

Color change in beamer at R markdown

Esteemed, I'm having trouble putting together a beamer presentation. I would like to put the title, the footer and the items in green tones. I appreciate any help. title: "long title" date: &...
0 votes
0 answers
25 views

! LaTeX Error: File `polyglossia.sty' not found [duplicate]

I get error as "! LaTeX Error: File `polyglossia.sty' not found. ! Emergency stop. <read *> Error: LaTeX failed to compile ase.tex. See https://yihui.org/tinytex/r/#debugging for ...
0 votes
2 answers
335 views

Bookdown bibliography with natbib omits URL for web pages

I am creating a pdf-book using bookdown, with the citation package natbib in the apalike style. I get my citations from a .bib file created by mendeley. I create my citations like this: [@citation]. ...
1 vote
1 answer
78 views

Syntax highlighting doesn't work after percent symbol %

I'm trying to highlight my R code using minted package. However, after %, a few lines didn't get highlighted. When I delete % problem disappears. My code: \documentclass{article} \usepackage{minted} \...
2 votes
0 answers
39 views

writing tables from r to latex without changing decimal format

I have ran a set regression in r and collected some of the statistics in a data frame format: variable|coefficient|s.e.|p-val|control|....| I am now writing that table using a template on my desktop ...
2 votes
1 answer
1k 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 ...
1 vote
2 answers
572 views

Numbering bookmarks in R Markdown

I want to number the bookmarks in my PDF that I am creating with R Markdown. When I add - \usepackage[bookmarksnumbered]{hyperref} to the YAML I get the following error message: ! LaTeX Error: Option ...
0 votes
1 answer
2k views

How to Integrate R code in TeXStudio?

I am writing my thesis in TeXStudio. One chapter features plots / analysis etc. that I am writing in a markdown in RStudio. Is there a way to kinda "link" the documents so the output from R is ...
2 votes
1 answer
394 views

Unexplained "NULL" in pandoc.table in ioslides [closed]

I'm attempting to use pander::pandoc.table() in a ioslides slide and I can't figure out how to get rid of the NULL caption at the bottom of the table. With this example code: ```{r, results='asis', ...
0 votes
1 answer
1k views

LaTeX Error: File `suffix.sty` not found

I would like my R Sweave file to run smoothly in Rstudio. I have tried to compile the following: \documentclass[a4paper,12pt]{article} \usepackage{amsmath,natbib} %\usepackage[utf8]{inputenc} \...
1 vote
0 answers
41 views

Compiling error with R plots

I appreciate your advice in advance. The following code worked around two years ago and it stopped working after I updated TexLive, and R to the latest version. The error message is Paragraph ended ...
2 votes
1 answer
249 views

latex - includegraphic with variables in the name

I'm no pro when it comes to latex and I'm working on something that's already been a bit established. I have a batch that produces multiple pdfs with a latex/sweave template. I'm attempted to insert a ...
0 votes
3 answers
12k views

How to use R's xtable() to print the output of table() and keep the row and column margin titles? and rotate

I need to generate many small tables from different pairs of vectors like this: (the vectors have names of different lengths) library(xtable) input1 <- c(0,0,0,1,1,1,1,2,2,2,2) input2 <- c(0,...
16 votes
4 answers
22k 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, ...
14 votes
4 answers
7k 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 ...
0 votes
0 answers
359 views

With R, knitr and RStudio, how do you compile a .dtx file to get the .sty file needed for a package?

Working through Stefan Kottwitz's LaTeX Cookbook, page 82, I tried to use the package pullquote. I am using R, the knitr library and the RStudio IDE. When I compiled the .Rnw script that has the ...
0 votes
0 answers
101 views

Merge columns with similar rows from another table (from stargazer in r)

I have two descriptive statistics tables created through the stargazer package in R. Table 1: \documentclass{article} \begin{document} % Table created by stargazer v.5.2.3 by Marek Hlavac, Social ...
0 votes
0 answers
53 views

Undefined control sequence for \NormalTok or \SpecialCharTok

I am using a template to write my thesis (https://github.com/ryanpeek/aggiedown) in latex. I have everything installed however, when I run bookdown (bookdown::render_book('index.Rmd', aggiedown::...
1 vote
1 answer
45 views

Control table height

I'm trying to create a table with mailing adresses to print so what I need is to match my table dimensions to the pre-cut sticker paper. So far I've managed to control column width with p{\dimexpr 0....
3 votes
3 answers
2k views

Table Limit: Sweave

I'm running into an issue. It seems that when I try to output more than 17 or 18 tables to a pdf document the remaining tables are ignored. When I split them across multiple Rnw files, there is no ...
2 votes
2 answers
4k views

How can I have a latex type expression as a column name in R?

I am working on many kables using the kableExtra package. Say you have a dataframe,df, that is 5 rows and 5 columns. in R you can do names(df)=c("A","B","C","D","E") for example. Once you have the ...
0 votes
1 answer
190 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 ...
0 votes
0 answers
34 views

Plots from R to Latex

I'm doing my thesis and would like to know if there is any way to import the plots from R studio to Latex directly. As by saving them and importing them to Latex the quality is very poor. Thank you so ...
1 vote
0 answers
564 views

Add R code to Latex document

I have a small amount of code I wrote in RStudio that my supervisors want me to include. Does anyone have any recommendations on how to include R code as part of a larger Latex document?
15 votes
2 answers
72k views

Insert R code in Latex

How can I define the color for the \listings package to display R code in Latex to get the result exactly like in the R Studio platform (example like in the figure)?
1 vote
0 answers
57 views

R equivalent for tikzDevice but for pstricks?

I use R for producing some graphics (with R base). Thereafter to better adjust the R graphics to use in LaTex I export the R plots with the tikzDevice library. Something like, e.g.: tikz('sk0.tex', ...
1 vote
1 answer
59 views

Formatting like R in Latex document

I'm an extreme beginner. I would like to write the names of R packages like "lavaan" in the screenshot attached, but I really don't know how to achieve that. Can anyone help? I would only ...
0 votes
1 answer
460 views

Leave Header Blank Fancyhdr

I am new to coding and Latex so please forgive me as I'm sure this is a very straight forward solution. I am creating a PDF report using RMarkdown with a .tex file to control the header, margins, and ...
0 votes
0 answers
29 views

Cannot compile correct fonts in LyX with sweave

Fonts in LyX look different when compiled without (first picture) VS with (second picture) sweave: What is happening and how can I resolve this issue? I'm using Windows 10, R 4.2.1 (with knitr and ...
0 votes
0 answers
29 views

Header Issue when knitting with jpg image

I am new to markdown and have to generate a weekly report with the proper header including a jpg image. I have the following yaml --- title: "My Title" author: "Author Name" date: &...
0 votes
1 answer
186 views

R-Markdown pdfLatex won't work when rendering shape ="\U0001f693"

This is my first time using r-markdown and running into problems rendering the symbol above. Everything else works great. It also works in r in ggplot2 but won't work in r-markdown. When I include &...
2 votes
1 answer
213 views

How to plot the DFT transformation of a vector with tikz/pgfplots?

My question seems to be simple but still I could not find any answer for that. Assume that we have a vector and its DFT which I computed it in R. > x <- c(3,9,4,2,5,6,2,6) > x [1] 3 9 4 2 5 6 ...
0 votes
0 answers
198 views

Error when including Hebrew characters in R markdown

I'm trying to create PDF report with R markdown. The report includes some Hebrew names as part of a table. When kniting the R markdown file, I get: ! LaTeX Error: Unicode character מ (U+05DE) ...
0 votes
2 answers
128 views

Referencing results from an output table

I have been always wondering if there were an optimal way to perform this task in papers. So for example, in my field it is normal to present an output table from R (like linear regression) showing ...
1 vote
1 answer
585 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
1 answer
242 views

R - Escaping a character from the BEST package for tikzDevice

I try to modify some plot output from the R BEST package with the help of the package tikzDevice. However, apparently tikzDevice can not proceed due to a parameter with a percent sign ("% HDI&...
0 votes
0 answers
444 views

pdfTex error: invalid font identifier. Metric (TFM) file not found

I am using the LawTeX template: LawTeX. When I try to compile the PDF, I get a pdfTeX error: invalid font identifier. Font T1/pnc/m/n/10-pncr8t at 10.Opt not loadable: Metric (TFM) file not found. ...
0 votes
1 answer
552 views

Problem with footer in rmarkdown

I have been trying to add a footer to this report, generated with rmarkdown; however, whatever I do, it just doesn't work for me. --- header-includes: \usepackage{fancyhdr} \usepackage{graphicx}...
1 vote
1 answer
2k views

the text is cut in the rmarkdown pdf file [closed]

As you can see in the picture, the text is cut off at the end of the page. What could done to prevent this? I have executed the following code and attached a pic for a better explanation. I would like ...
3 votes
2 answers
736 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{...
11 votes
2 answers
41k 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 &= \...

1
2 3 4 5
12