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
12 views

Problem Including complied Rstudio output Tex file in Latex

I'm having difficulty including the output.tex file in my Latex file. If i compile just that file I get the desired output which looks like the output file like you would see from the MS word output, ...
1
vote
1answer
25 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
29 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
0answers
7 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
19 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
50 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
42 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
20 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
41 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
137 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
17 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
36 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
31 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
42 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
112 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
260 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
43 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
39 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
313 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
50 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
283 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
184 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
214 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
105 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
28 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
201 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
167 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
87 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 ...
3
votes
1answer
322 views

R Markdown/pandoc: Change how code blocks are converted to LaTeX

I use rmarkdown to generate a pdf file (which uses pandoc, which in turn uses pdflatex). By enabling keep_tex option, I noticed that code blocks without language type always become verbatim, e.g.: ```...
3
votes
3answers
1k views

Export plots from R directly to Latex

Is there a way to export plots from R directly to latex, more specifically TexStudio? I think exporting/saving the image from R and then importing it to R looses some of the quality. I saw on the ...
2
votes
1answer
483 views

How can I have a latex type expression as a column name in R?

I am working on many kables using the kableExtra package. Say you have a dataframe,df, that is 5 rows and 5 columns. in R you can do names(df)=c("A","B","C","D","E") for example. Once you have the ...
1
vote
1answer
42 views

R studio cannot make xtable

library(xtable) library(magrittr) library(moonBook) options(ztable.type="html") a=mytable(head(iris)) a x = xtable(a) x i cannot make xtable, just use mytable... want to use xtable, but output like ...
0
votes
0answers
91 views

Basic R code yields errors of “unclosed $” in knitr

I cannot use R code in Overleaf Knitr, since any basic code which includes $ yields error of unclosed $. Even the sample file of knitr in Overleaf itself causes LaTeX error: https://www.overleaf.com/...
0
votes
1answer
163 views

Problem when compiling book with bookdown - natbib error

I am creating a pdf-book with bookdown using the following YAML: --- site: bookdown::bookdown_site geometry: "left=4cm,right=3cm,top=3cm,bottom=3cm" subparagraph: true output: bookdown::pdf_book: ...
0
votes
2answers
1k views

How to use R's xtable() to print the output of table() and keep the row and column margin titles? and rotate

I need to generate many small tables from different pairs of vectors like this: (the vectors have names of different lengths) library(xtable) input1 <- c(0,0,0,1,1,1,1,2,2,2,2) input2 <- c(0,...
0
votes
1answer
50 views

Bookdown bibliography with natbib omits URL for web pages

I am creating a pdf-book using bookdown, with the citation package natbib in the apalike style. I get my citations from a .bib file created by mendeley. I create my citations like this: [@citation]. ...
2
votes
1answer
41 views

The following character ``[`` isn't working in table, error : ! Paragraph ended before \CT@rowd was complete. \par

I'll ask my question here since I think it has more to do with LaTeX than stackoverflow. I am using R Markdown with LaTeX to create pdf documents that shows some tables. Using the R language with ...
2
votes
1answer
123 views

How can I get Rchunks to render inside tcolorbox?

I've created a reprex to show my problem, but I am having this same issue in a custom Rmd template I am crafting. I would like to be able to include stylized code chunks and plot outputs inside of ...
0
votes
0answers
102 views

Including R code in latex

I have some problems by inverting my R code into latex and than copying the code of the pdf back into R. I used lstlistning to read the R code and since it did not show the -, I used this code: \...
2
votes
1answer
59 views

Why can't I center my table using xtable and lualatex in rmd

Can anyone help me solving my issue with xtable, please ? I create a table using xtable, based on data that I processed Rstudio. The main R code runs a Rmd script who generates a pdf with that table....
1
vote
1answer
196 views

Is there a latex package for working with Rtex files locally

Working with Overleaf using .Rtex files and I love it. However, I just discovered that Overleaf does not support a lot of the R packages (e.g., tidyverse, sqldf) and does not work with large data sets....
0
votes
0answers
2k views

How to add cover pages to rmarkdown pdf file?

I need to add a coverpage at the very begginning and end of a pdf document i have made using R Markdown. (My first time using R markdown and latex) As it is now, the first page of the file output is ...
0
votes
0answers
51 views

Accessing variable in inline expression (rmd to pdf output)

I'm working on coding a reproducible rmd which will output a pdf document. I know that for an inline expression to work, it requires $ $ to be placed around it but is there a way around this? Client &...
1
vote
1answer
186 views

How to avoid the extension files when I compile pdf on r sweave

I face a problem when I compile pdf file I got many files in the working directory, for example, the files Untitled.tex and Untitled.toc along which my files Untitled.pdf and Untitled.Rnw. Can anyone ...
2
votes
1answer
711 views

Embedding R (kable) results in LaTeX

Apology at first if this question has been asked or the sample is not reproducible. I'm totally new to LaTex and happy to take any advice. I am working on my thesis on a .tex LaTex template given by ...
1
vote
1answer
1k views

Math symbol in Rmarkdown list

I am trying to get the following code to render correctly in rmarkdown, but unfortunately math mode does not seem to work in a list setting? Can anyone help with this? --- title: "Trial" author: "Jon"...
2
votes
2answers
361 views

How to make Manual references appear in bibliography (citing R)

I would like to cite R in my bibliography. However I'm having trouble getting it to appear. Here my mini.bib files contains @Book{, author = {Hadley Wickham}, title = {ggplot2: Elegant Graphics ...
2
votes
1answer
94 views

Manual bibliography in knitR with \bibitem{} works but cannot use \cite{} with it

I am trying to use a manual/embedded bibiography in a knitR/LaTeX document (long story short but for various reasons I don't want to be using a seperate .bib file because this script will be used many ...
2
votes
2answers
232 views

How to use \sexpr{} with variable that has “_” in it (i.e. avoid “math mode” error)

I am using knitr in R to write up a document in LaTex. Below a certain of code, I would like to refer to a variable I used in R. <<chunk>> var <- "ENSEMBL_MART_ENSEMBL" @ In this ...

1
2 3 4 5
11