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
29 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 ...
1 vote
0 answers
25 views

How to cite a "R package" in the reference part of research paper?

I want to cite a R package in my scientific research paper. However, the package is not in google scholar so I don't know how to cite it. Also the package is quite new and unpopular so I couldn’t find ...
  • 11
0 votes
0 answers
40 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 ...
  • 1
0 votes
0 answers
27 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
38 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....
  • 113
0 votes
0 answers
233 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
27 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
297 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
53 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', ...
  • 277
1 vote
1 answer
51 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
28 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
23 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
126 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
145 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) ...
  • 101
0 votes
2 answers
88 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
332 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,433
0 votes
0 answers
282 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
1k 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
159 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&...
  • 170
0 votes
1 answer
417 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
359 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
188 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
67 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
97 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
202 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
1 answer
36 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
161 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
2k 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
185 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
65 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
67 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
135 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
45 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
59 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
376 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
96 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
50 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
1 vote
1 answer
858 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 ...
  • 11
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
1 vote
1 answer
518 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
132 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
94 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
562 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
714 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
1k 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
71 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
481 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

1
2 3 4 5
12