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
0answers
29 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: ...
0
votes
0answers
12 views

How to export an interactive graph from plot to Overleaf without converting it into a static one in R

I am currently involved using an interactive world map of this kind https://www.youtube.com/watch?v=RrtqBYLf404 I have two possible questions that may solve my problem: Do you know how to include the ...
0
votes
0answers
31 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 ...
0
votes
0answers
54 views

Missing number, treated as zero.for ifnumcomp in tinytex using R

I have an project that I am compiling using TinyTex. When compiling the project in R using tinytex::pdflatex('dissertation.tex'), it gives error as shown below. ! Missing number, treated as zero. <...
1
vote
0answers
16 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: &...
1
vote
1answer
30 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: %----- ...
0
votes
1answer
42 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( ...
0
votes
0answers
28 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 ...
3
votes
1answer
82 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 ...
1
vote
2answers
59 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 ...
0
votes
0answers
29 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?
1
vote
1answer
59 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 ...
0
votes
1answer
86 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 ...
1
vote
1answer
35 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 ...
1
vote
2answers
48 views

How to conditionally display in bold a R generated p-value with the symbol < (<0.001 or < 0.001)?

I have LaTeX tables being automatically generated (populated) via R (Rstudio, Knitr), and compiled with PdfLaTeX (MiKTeX). There are rows of p-values for each statistic test. I am using this ...
1
vote
1answer
18 views

How to include Rd2pdf latex file as appendix in document

I Have created an R package, I want to include the documentation as an appendix in my Thesis document. To create the latex file I did the following (I am partly including this to make it easier for ...
0
votes
0answers
15 views

Long commentaries lst (R)

I am making a Latex docuemnt where I have to input some code in R with the command \lstinputlisting. I have my own style defined with the following configuration: \lstdefinestyle{mystyle}{ ...
0
votes
0answers
13 views

lstlistings in a two column setup

How can I use lstlisting in a two column setup, meaning that the code block is spreading over both columns? (lstlisting* is not valid.) - I dont want two listings side by side!
0
votes
1answer
26 views

R ztable latex output not working

I created a table using the ztable package in r. I cannot get the output to work in LaTeX though. I am getting error messages like this; l.74 \definecolor {tempcolor1}{rgb}{0.98,0.41,...
1
vote
0answers
26 views

Executing R Codes (Dynamics Reporting) in LaTex Beamer [closed]

Dear all LaTex experts, I am trying to writing some R codes and execute it in a LaTex beamer environment, or what is commonly known as dynamic reporting, but in beamer. The editor that I use for LaTex ...
1
vote
0answers
46 views

Is there any tool/framework to convert R code into Latex?

I have a lot of code from R, and I'm working on a research project where I need to write down the pseudocode, is there any way to convert these codes into latex?
0
votes
0answers
39 views

How do you align latex to left side of knitted pdf in rstudio?

I'm creating a notebook in rstudio for the first time, and I need to knit a pdf with latex. At the moment, I have latex in the middle of the document, but I'd like it aligned to the left, as the red ...
0
votes
1answer
48 views

Getting error of including $, when it is not necessary

Hi all I have the following code in r: $$ln(L(\lambda))=(\sum_{i=1}^{n} y_i)(ln(\lambda))-n\lambda$$ when trying to knit the document I get an error that says: I have never gotten this error before, ...
1
vote
1answer
32 views

How to pass a variable from Rmd file to a latex file

I have two file 1. index.rmd file and the other is 2.Preamble.tex file I want to delclare a variable in index.rmd i.e. a <- 'Start and end with single quote' I want to pass the above variable in ...
1
vote
1answer
30 views

extract all the xtables in to the one .tex file from r

I have two xtables in my R script and I would like to extract them the same .tex file then I can call them to my main.tex with \newcommand print(xtable(head(mtcars), digits =2, caption = "...
1
vote
0answers
42 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
0answers
91 views

Cannot install R packages in the Knitr environment Overleaf

I am trying to write my R code directly in my Overleaf document using knitR. However, this message pops up when I run the following code:
0
votes
0answers
133 views

Figures showing at the end of the document in R markdown

I have been working on this issue since yesterday and have checked almost all the solutions but I'm still not able to solve this issue. All the figures and tables I put in the document shows at the ...
0
votes
1answer
62 views

How can I format R codes in a 'normal' sentence in LaTeX in the language of R?

I'm new to latex and trying to put my R codes in latex, which I have done in the following way: \lstset{language=R, basicstyle=\small\ttfamily, stringstyle=\color{DarkGreen}, otherkeywords=...
0
votes
0answers
88 views

How do I insert a CFA output from R into Latex using lavaan and semTable?

I am not very experienced when it comes to Latex or R. As said in the title, I have a CFA output I generated with R Studio and now want to insert into Latex. Unfortunately, whenever I do this, my ...
0
votes
0answers
47 views

Can I tell TeX not to interpret $$ at all?

I'm working with survey data in R. We have a bunch of text answers to open ended questions that I just want to dump into a readable table with Knitr's Kable function. Unfortunately, some of the ...
0
votes
0answers
42 views

Error compiling latex-table from semTable package

I'm trying to compile a PDF in texmaker with a table from the semTable-package in R. Unfortunately, I'm getting an error when doing so. Since I'm a massive greenhorn with LaTex, I would be very happy ...
0
votes
0answers
12 views

Color for the text when using “lstlistings” with R text

I am using the environnement "lstlistings" to insert chunks of R in a LaTeX paper. I would like to have the text of R commands in blue color and the output of R in red color. How can I do ...
0
votes
0answers
22 views

knitr: change the tidyverse italic font in Soutput environment comments?

In printing a tibble, for example, the output begins \begin{Soutput} # A tibble: 30 x 2 cond rating ... # … with 20 more rows \end{Output} The output formatting is defined by \usepackage{listings}...
1
vote
1answer
525 views

Issue with LaTeX code in “header-includes” in R Markdown file after R and RStudio upgrade

I use the following LaTeX code in the YAML of my R Markdown document (that produces, as output, a PDF): --- output: pdf_document: latex_engine: xelatex header-includes: - | ```{=latex} \...
0
votes
0answers
46 views

I updated MiKteX some days ago (11/08); Since I dit that, “lstlisting” doesn't work

I want to include R code in a tex source by using the environment lstlisting from the package listings. It is a paper I began to work on some weeks ago. The inclusion was working correctly during some ...
0
votes
2answers
396 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 ...
0
votes
1answer
89 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 ...
1
vote
1answer
303 views

Inserting a logo below date in Rmarkdown YAML

I am using the following template in RMarkdown to create a PDF. Is there a way in which the following logo can go below the date instead of above the title? --- title: Adding a Logo to LaTeX Title ...
0
votes
0answers
293 views

How to indent a numbered list of references in R markdown as in latex?

I post this same question in stackoverflow (https://stackoverflow.com/questions/61060820/how-to-indent-a-numbered-list-of-references-in-r-markdown) and I was suggested to ask here. So, my problem is: ...
2
votes
1answer
27 views

Knitr: storing variables for later use

I'm relatively new to Knitr. I want to run a function just once, so that next time I don't have to evaluate it, because it would yield a different result. My MWE: First time: \documentclass{article} \...
1
vote
1answer
70 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
1answer
53 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 ...
1
vote
1answer
64 views

round-minimum in siunitx when input is zero

I use siunitx and its round-minimum=0.001 function. I have a table with input 0 because knitr exports only numbers up to a certain decimal. However, 0 is not shown as <0.001 but as 0. According to ...
0
votes
0answers
75 views

How to call TinyTeX from text editors (command line)?

I use some editors like TeXstudio, etc., and they work with "command line" commands like (example with TeXstudio and pdflatex): pdflatex --shell-escape %.tex In this case, % is a variable for the ...
0
votes
1answer
249 views

long xtable() with align and footnote

have a long table and I would like to do a custom column width, with a footnote, the R code looks like below and align() to specific column width does not working? many thanks in advance, x <- ...
0
votes
1answer
33 views

Exporting a LaTeX table from R with the derivmkts package

I'm fairly new to R and I'm currently playing around with the R derivmkts package and it's binomopt function. The function gives me an output of the option prices and stock prices that are visible as ...
1
vote
3answers
217 views

LaTeX - Writing Text In A Matrix

I am trying to write text into a matrix to describe what an element at a particular row and column represents. The following is as far as I got ( after a few hours! ): \begin{equation*} P_{m,n} = \...
0
votes
2answers
191 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 ...
1
vote
1answer
40 views

How to prevent of removing spaces from string by Sexpr?

Here is a string variable. a <- 'This is a sample sentence' If I want to print in inline text mode for PDF, I can write it this way: $\Sexpr{a}$ But, I am getting the output like this way: ...

1
2 3 4 5
11