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
0answers
13 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
32 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
25 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
26 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
26 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
21 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
10 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
44 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
23 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
43 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
20 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
9 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
15 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
100 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
45 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
138 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
42 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
63 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
96 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
23 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
59 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
42 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
40 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
54 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
111 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
30 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
122 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
110 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
27 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: ...
0
votes
1answer
98 views

R symbol in LaTeX [duplicate]

I am loooking for a LaTeX command similar to \LaTeX but for the statistic program R. Does anybody know if there exists sth?
0
votes
0answers
207 views

RMarkdown PDF Fatal error : Undefined control sequence (\grffile@filename). Possible Bad Character?

I have written a R script to generate 2 RMarkdown PDF reports for a given dataset. The script runs without error on my main Linux machine with Texlive. I adjusted it for my work laptop with Windows ...
0
votes
0answers
65 views

How to change paper size for certain pages in R markdown

This question is replaced from stack overflow to here. I am working on a markdown file, but one table in particular is huge. I was able to set the pages where this table is occurring to landscape ...
0
votes
1answer
75 views

Parts of ggplot PDF image disappearing

I am using the tufte-book documentclass and template. I have been exporting ggplot2 images to PDF format, and then including them in LaTeX in figure environments. Everything was going fine, until one ...
0
votes
1answer
59 views

How to make R output smaller? (For example, reduce the font size, margins etc)

I am trying to fit this output all on one page on overleaf. How would I do that? \begin{lstlisting}[language = R] > expand.grid(c(21:25), c(21:25), c(21:25)) Var1 Var2 Var3 1 21 21 21 ...
0
votes
0answers
52 views

Getting %*% using listings for R

I am getting an error when importing R code into latex with the %*% symbol for matrix multiplication. How do I edit the following in order to allow me to add %*% from R to latex output without ...
0
votes
0answers
22 views

Is it possible to specify options for preventing incomplete words in Rmarkdown? [duplicate]

I'm working with Rmarkdown and my output is a pdf document. When reading the text, I noticed that so many words are printed incomplete such as "ar- rojan" and "progra- mación" (which should be "...
1
vote
1answer
363 views

Alternative approaches to R markdown to compile PDF output

I am a new user of R and R Markdown and understand that R markdown has some functionality to compile PDF documents that include R script. I have two questions: Does R markdown have the same ...
2
votes
0answers
346 views

Compilation problem with fontenc-Latex - LaTeX2e problem

Unfortunately, I am experiencing the same issue as reported in Compilation problem fontenc-Latex. I reinstalled my TeX installation and ran tlmgr update, all to no avail. I am using RStudio Version 1....
2
votes
1answer
121 views

Different colours for R input and output using listings

I need to quote some R commands and a few scripts, and sometimes to show the output. I would like that the output had a different colour than the input, but I have no idea how to. A minimal example ...
1
vote
1answer
52 views

Spaces in data.frame in R Sweave

I'm making a table in R Sweave using a data frame, but I don't know how to create spaces between the titles, they come out is separated by points. Is there a command that solves this? with the ...
1
vote
1answer
850 views

How to customize header with Rmarkdown?

I'm currently working on a pdf document using Rmarkdown on RStudio but I'm very much confused about to how to customize my YAML section. This is my actual code: --- title: "The very basics of R" ...
0
votes
0answers
56 views

Make documents where the date printed on the document is automatically the date of creation of document

Is there a way to create latex documents where the date printed on the documents is always by default the date of creation of the document? I don't want to compile the same latex file 30 days later ...
1
vote
0answers
566 views

How to overcome LaTeX Warning: Command \@footnotemark has changed?

I'm using rmarkdown, and after knitting a document I always receive this warning (the document knits normal, though). Output created: XY.pdf Warning message: LaTeX Warning: Command \@footnotemark ...
0
votes
2answers
303 views

Rmarkdown code style in LaTeX

I would like my R code in latex to look like the rmarkdown block of codes: Distinct colours for functions and grey background. I pasted my code between \begin{markdown} and \end{markdown} But this ...
2
votes
3answers
295 views

How do I transfer output of animation R package on a beamer frame

I have the following R code from animation package that generates a random number which adds random number generated one after the other on display on R terminal. library("animation") brownian.motion(...
2
votes
1answer
153 views

Can't fit a table in beamer

This is the output of the stargazer package that I did in R. However, I can't make the table fit in my beamer presentation. Here is the code: % Table created by stargazer v.5.2.2 by Marek Hlavac, ...
1
vote
1answer
32 views

How compile Knitr in TeXnicCenter?

some of you have tried using TeXnicCenter to compile Knitr, well I would use TexStudio but it is heavy again. I appreciate your help error 'Rscript.exe no such file or directory'
0
votes
1answer
278 views

Deploy custom fonts to shinyapps.io for application that produces an R Markdown report

I have a shiny application that produces an R Markdown report in pdf format, so I used also LaTeX to customise it. In my YAML I use the fontspec package to specify a custom font for the whole document ...
1
vote
0answers
233 views

Images are not rendered with bookdown after updating packages

I am using bookdown with RStudio to create a pdf-book. After updating latex-packages with tinytex::tlmgr_update(), images were suddenly not rendered anymore, either with knitr::include_graphics() or \...
3
votes
2answers
96 views

How Can I Get A LaTex Table Generated By R's MonteCarlo Package To Work?

I have been experimenting with the MonteCarlo package in R for a project. After using the maketable function, I was given the following code to generate a LaTex table with the Monte Carlo simulation's ...

1
2 3 4 5
11