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
1 vote
0 answers
84 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: ...
user avatar
  • 8,349
0 votes
0 answers
43 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. ...
user avatar
1 vote
1 answer
33 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 ...
user avatar
0 votes
1 answer
38 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&...
user avatar
0 votes
1 answer
40 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}...
user avatar
0 votes
2 answers
65 views

Error in the code after loading a library in an R code

I have been writing a code in RStudio and using TinyTex to compile my pdf. I wrote the following code in an RSweave file in RStudio: \documentclass[12 pt]{article} \usepackage[utf8]{inputenc} \...
user avatar
0 votes
0 answers
60 views

Problem Solved - Multiple issues with Sweave and Knitr

Here is the Github link of the files and a short description of the issues: https://github.com/Euniceisnice/What-is-wrong-with-my-Tex-and-Sweave I have never managed to compile my Rnw file with Knitr. ...
user avatar
0 votes
1 answer
65 views

How do I adjust these texts dynamically depending on length of name?

The following code \documentclass{article} \usepackage{eso-pic,graphicx} \usepackage[absolute,overlay]{textpos} \usepackage{fontspec} \setmainfont{Segoe UI Symbol} \usepackage[top=2cm, bottom=2cm, ...
user avatar
  • 13
0 votes
1 answer
55 views

Help required regarding using inline R commands in overleaf

I am using overleaf to compile my R codes into a pdf file. For a chunk of code, we use for example: <<>>= mean(reading) max(reading) min(reading) @ But now I want to use these commands ...
user avatar
1 vote
0 answers
21 views

How do I assign these variables from Rmarkdown? [duplicate]

I have variables that are going to be dynamic in this document. How do I assign theme from Rmarkdown. Below is how my .tex file looks like So for example $District_Name$ is a dynamic variable. I want ...
user avatar
  • 13
2 votes
4 answers
163 views

Create an empty command

In my research, I do my analysis in R and write the paper in LaTeX. To avoid updating values in the paper when my analysis change, I update the values in the paper directly from R. Assume in R I have ...
user avatar
  • 131
0 votes
0 answers
28 views

Highlighting R Syntax in .Rnw file

I'm trying to write my lecture slides using beamer (knitr/sweave). However, when I'm adding the R syntax, the most I can do is boxing it, but I want to have my syntax highlighted. Something that is ...
user avatar
0 votes
1 answer
25 views

How to avoid that xtable flips the x and y axis of a R table in the final tex output?

I work with xtable which turns a table of r into a functionable latex code. <<echo=false>>= attach(warpbreaks) p2 <- round(tapply(breaks, list(tension), mean), digits=2) %>% as....
user avatar
3 votes
2 answers
80 views

variable into TEX document?

I am trying to get a STATA macro or an R variable into Latex. This is relatively straightforward with R markdown, but I'm hoping for a pure TeX solution. e.g. say I have a document that says Our ...
user avatar
  • 205
0 votes
0 answers
251 views

Cannot fix: ! LaTeX Error: File `pdflscape.sty' not found

I am using tinytex, Windows 10, R Studio install.packages("tinytex") tinytex::install_tinytex() and keep seeing the following error when I try to run a .Rmd file which contains \usepackage{...
user avatar
  • 1
0 votes
0 answers
62 views

Error message: undefined control sequence \includegraphics

I am running the following code in R: tmp <- mtcars[, c("mpg", "hp")] # create a list with individual variables # remove missing and rescale tmp_list <- lapply(tmp, na.omit) ...
user avatar
  • 53
1 vote
0 answers
40 views

How can I get R and Tikz to cooperate in a loop?

I'm using knitr and compiling my .Rnw file in Rstudio. Here's a MWE illustrating my issue. I want the code below to output "1, 2, 3" but instead it gives me "1, 1, 1". %%%%%%%%%%%%%...
user avatar
  • 11
1 vote
1 answer
49 views

How to import a sentence from a .txt file that will preserve the font characteristics of the rest of the paragraph?

I have numbers from an R script that I would like to include in a report that I am typing in LaTeX. There are enough numbers that I am concerned about making a typo, and I don't want to do copy/paste ...
user avatar
  • 113
0 votes
0 answers
25 views

How to include a C plus plus file into rmarkdown while using the Rcpp engine to render the file's text content

So I have an rmd file which contains my analysis of some cpp source code which is in a file called twoSum.cc. I simply want to be able to edit this cpp seperately and the rmarkdown seperately. I do ...
user avatar
0 votes
0 answers
20 views

Sweave Missing endcsname Error in Huxtable While Generating PDF

I am running into an issue in the process of generating PDFs through R/Sweave/tinytex on a CentOS server. Here is the command that runs the process: (generateReport.R) Sweave(rnwFile, encoding = "...
user avatar
1 vote
1 answer
40 views

double quotation marks creates issues in listings [closed]

I'm writing a R code in LaTeX using the listing package. Everything works fine in the first two lines, with the code written in plain text and the comments in italic. However, after this string quote=&...
user avatar
0 votes
1 answer
30 views

R - sweave - count words

I could not find a clear solution, so I would like to ask if there is some tool to count words (excluding R - latex code) in a .Rnw file. Thank you!
user avatar
  • 1
1 vote
1 answer
27 views

R sweave - stop tables from floating

Please excuse my naive question: I am using R studio sweave with xelatex and tinytex I run this chunk to produce a table, but it is automatically printed on the last page, adding a huge blank space ...
user avatar
  • 31
1 vote
1 answer
196 views

Updating R Counter in for loop

I have written a for loop in LaTeX using the forloop package, and on each iteration, I would like to use a different subset of a vector that is defined in an R chunk above. However, each iteration of ...
user avatar
1 vote
0 answers
67 views

Aligning note text to the left in a regression table produced by R (etable) [closed]

My R function (etable) provides me with the following latex table: \begin{tabular}{lcc} \tabularnewline\midrule\midrule Dependent Variables:&Earnings&Employment\\ Model:&(1) & (2)\\ \...
user avatar
1 vote
0 answers
29 views

How to generate a table where each cell is the alpha (and standard error) of a different regression [closed]

I am trying to replicate the following table using R: I have the coefficients and the standard errors in a melted table. I know how to transform them into two different tables (one for coefficients ...
user avatar
2 votes
1 answer
41 views

Aligning a TeX Code appropriately in LyX

I'm a bit new to using LyX to typeset my R code (using the Rnw(knitr) module) into a pdf. While working on it, I came across a problem. Say, for example, I have a dataset in the form of a table like ...
user avatar
  • 143
0 votes
1 answer
442 views

! LaTeX Error: File `tikz.sty' not found in R Studio MacBook Air

This is a new user of R. TikzDevice and ggplot2 have been installed in R Studio on MacBook Air. An error occurred when trying to run the blue code in the screenshot. I tried to use tikzTest() to check ...
user avatar
  • 1
0 votes
1 answer
568 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} \...
user avatar
  • 1
0 votes
1 answer
386 views

!pdfTeX error: pdflatex (file t1-zi4r-0): Font t1-zi4r-0 at 540 not found

My issue is same as this problem Error: Font ts1-zi4r at 540 not found In my case, I am running Rstudio server on a remote machine for work. When trying to build the vignette/manual pdf I get this ...
user avatar
3 votes
0 answers
124 views

R Code with minted, "¡-" instead of "<-" and underscores are omitted [duplicate]

I am using overleaf to write a LaTeX document. I want to include some R code blocks with minted, but minted displays my arrows in the code "<-" like this: "¡-". How can I fix ...
user avatar
  • 163
1 vote
0 answers
59 views

Why are my plots not appearing properly? [closed]

I got a new laptop last week and installed TexStudio and TexShop. When using TexStudio, my pdf plots from R aren't displaying properly. An example is below. This is it in TexStudio: But this is the ...
user avatar
  • 11
1 vote
0 answers
330 views

inline Latex in R markdown

I have a question about inline R Markdown code: I have a finished LaTeX table that looks like this: \begin{table}[!h] \centering \begin{tabular}{ |c|c|c|c|} \hline $\textbf{Vorname}$ & $\textbf{...
user avatar
  • 11
1 vote
0 answers
354 views

LaTeX expressions in xlabel of R plot

Im trying to print $\lambda = $ lambda" (where lambda outside of the dollar signs is a variable) on the xlabel of a plot I'm making in R using the latex2exp package. When I use: xlab = paste(TeX(...
user avatar
  • 11
0 votes
0 answers
947 views

RStudio, pdflatex fails to knit to pdf and crashes

I'm trying to compile a simple Rnw file in RStudio using knitr's "compile pdf" functionality. But it gives me an error. This is what I have in Vorlage.Rnw: \begin{document} Hello World \...
user avatar
  • 1
0 votes
2 answers
642 views

TeX("$\lambda$") doesn't work in R

Im using the latex2exp package to make some plots in R with latex expressions in the labels. TeX("$\lambda$") on the xlabel doesn't print what it needs to. The documentation said to use TeX(...
user avatar
  • 11
0 votes
0 answers
24 views

Misspecify $ in-text [duplicate]

the following equation is kind of creating an issue when I'm typing it in-text $\frac${$\partial$ LL}{$\partial$ $\Omega$}$ Am I mis-specifying $ anywhere?
user avatar
0 votes
1 answer
51 views

Several error in equation typing

This is my equation. \begin{equation} E$\epsilon$$\epsilon$=V$_$$\epsilon\$=$\Omega$ \end{equation} These are the errors that I'm receiving Dispaly math should end with $$ Missing $ inserted Missing {...
user avatar
1 vote
0 answers
164 views

Error in trying to write $\bar{X}$ in R markdown [closed]

I want to write the distribution of the average of n i.i.D's. However I keep receiving the following error when I write the following in R markdown. $$\bar{X}\sim N(\mu_X,\frac{\sigma^2}{n})$$ Error: ...
user avatar
  • 111
0 votes
1 answer
365 views

Export descriptive statistics by group from R to LaTeX without exceeding width

I am trying to reproduce, in LaTeX (Overleaf), a table of summary statistics divided by country-year. The table I got is exceeding width and I can't solve it with solutions I've seen in other ...
user avatar
1 vote
0 answers
48 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: &...
user avatar
  • 11
1 vote
1 answer
357 views

Help rendering booktabs tables in RStudio

Can I use the booktabs package in R? I am using RStudio and could not find a way to install a version of the booktabs package. The table I am trying to render in a .Rmd file is provided below: %----- ...
user avatar
0 votes
1 answer
329 views

How to put parentheses for multiline text in r markdown?

Could anybody help me to overcome this? I've tried several ways but it still didnt't work. I wanna put big parentheses for these three line texts like the image below but I couldn't do it. $$\left( ...
user avatar
0 votes
0 answers
318 views

How do I include R generated plots in LaTex?

I use R for data analysis and to create quite complex graphs. Now I am looking for a nice (and easy) way to include my plots in LaTex. Preferably, vector-based and automatically with the font I am ...
user avatar
  • 139
3 votes
1 answer
168 views

How to load additional packages with R::rticles?

I mostly code in R, and have been using knitr Rnw for a while, mostly following the best practices outline in 14mech14's YouTube videos, with a parent rnw document, child rnw document, and a document ...
user avatar
  • 205
1 vote
2 answers
76 views

Underline text with === (SETEX style)

I'm trying to recreate the typewriter look. How to make \underline{sometext} work like SETEX-style section marker? The intended use is with monospaced/typewriter fonts for lines with plenty of space ...
user avatar
0 votes
0 answers
1k views

R font in latex

I wanted to describe some R packages in latex document and I'm wondering what font (and how to use it like 5 times) is usually used in names of packages?
user avatar
  • 1
1 vote
1 answer
423 views

Including images in an R code chunk of R sweave using for loop

I am new to sweave and Latex. I am basically using an if-else loop which should display some specific image (taken from the laptop) if certain condition is satisfied. When I run this loop in R, the ...
user avatar
  • 13
0 votes
1 answer
156 views

\textwidth is not recognized, causes illegal unit error

I switched computers, reinstalled R, and am now getting an "Illegal unit of measure" error when I run the following code. I've narrowed it down to the "\textwidth" portion - when I ...
user avatar
  • 1
1 vote
1 answer
70 views

Question about using book down in R-do I need to load packages on each page? Help with basic understanding!

Please forgive the v basic question. I have recently started using R bookdown, to try write papers. I've read the cookbook and book down guide. I use rmardown, and understand that, but I don't ...
user avatar
  • 113

1
2 3 4 5
12