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
0 votes
0 answers
39 views

Unrecognized object error in Stargazer with Portmanteau Test?

Could someone please help me in understanding why I get this error with the stargazer function in R? This is my code Serial1<-serial.test(Modeldataset1, lags.pt=12,type="PT.asymptotic") ...
0 votes
0 answers
25 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
1 answer
46 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?
1 vote
0 answers
51 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', ...
  • 267
1 vote
1 answer
46 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
0 answers
23 views

Plot Created and saved by R Plot Is Not Found By Latex

I use this code to create R plot but it is not found in latex. library(ggplot2) library(reshape2) set.seed(199) MB_RMSE_sd1 <- runif(12, min = 0, max = 2) TMB_RMSE_sd1 <- runif(12, min = 0, max ...
0 votes
0 answers
22 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
19 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
49 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 &...
0 votes
0 answers
79 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) ...
  • 1
0 votes
2 answers
50 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
0 answers
205 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: ...
  • 8,381
0 votes
0 answers
162 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. ...
1 vote
1 answer
529 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 ...
0 votes
1 answer
118 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&...
  • 171
0 votes
1 answer
262 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}...
0 votes
2 answers
156 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} \...
0 votes
0 answers
146 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. ...
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, ...
  • 13
0 votes
1 answer
80 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 ...
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 ...
  • 13
2 votes
4 answers
185 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 ...
  • 131
0 votes
0 answers
56 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 ...
0 votes
1 answer
29 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....
3 votes
2 answers
100 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 ...
  • 205
0 votes
0 answers
388 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{...
  • 1
0 votes
0 answers
107 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) ...
  • 53
1 vote
0 answers
51 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". %%%%%%%%%%%%%...
  • 11
1 vote
1 answer
58 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 ...
  • 113
1 vote
1 answer
67 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=&...
0 votes
1 answer
36 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!
  • 1
1 vote
1 answer
35 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 ...
  • 31
1 vote
1 answer
293 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 ...
1 vote
0 answers
85 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)\\ \...
2 votes
1 answer
46 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 ...
  • 153
0 votes
1 answer
648 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 ...
  • 1
0 votes
1 answer
936 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
1 vote
1 answer
449 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 ...
3 votes
0 answers
128 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 ...
  • 163
1 vote
0 answers
74 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 ...
  • 11
1 vote
0 answers
487 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{...
  • 11
1 vote
0 answers
539 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(...
  • 11
1 vote
0 answers
1k 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 \...
  • 11
0 votes
2 answers
934 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(...
  • 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?
0 votes
1 answer
65 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 {...
1 vote
0 answers
274 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: ...
  • 111
0 votes
1 answer
461 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 ...
1 vote
1 answer
73 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: &...
  • 11
1 vote
1 answer
537 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: %----- ...

1
2 3 4 5
12